mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-02-25 20:30:10 +08:00
feat: improvement to template
This commit is contained in:
parent
67bbe33498
commit
bafa8ae8ae
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@ -24,12 +24,12 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 14
|
node-version: 18
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm install
|
run: npm install
|
||||||
|
7
.gitignore
vendored
7
.gitignore
vendored
@ -10,9 +10,12 @@ lerna-debug.log*
|
|||||||
node_modules
|
node_modules
|
||||||
dist
|
dist
|
||||||
dist-ssr
|
dist-ssr
|
||||||
|
dist-electron
|
||||||
|
release
|
||||||
*.local
|
*.local
|
||||||
|
|
||||||
# Editor directories and files
|
# Editor directories and files
|
||||||
|
.vscode/.debug.env
|
||||||
.idea
|
.idea
|
||||||
.DS_Store
|
.DS_Store
|
||||||
*.suo
|
*.suo
|
||||||
@ -21,9 +24,7 @@ dist-ssr
|
|||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
|
|
||||||
release
|
# lockfile
|
||||||
.vscode/.debug.env
|
|
||||||
package-lock.json
|
package-lock.json
|
||||||
pnpm-lock.yaml
|
pnpm-lock.yaml
|
||||||
yarn.lock
|
yarn.lock
|
||||||
dist-electron
|
|
||||||
|
10
.vscode/.debug.script.mjs
vendored
10
.vscode/.debug.script.mjs
vendored
@ -1,8 +1,8 @@
|
|||||||
import fs from 'fs'
|
import fs from 'node:fs'
|
||||||
import path from 'path'
|
import path from 'node:path'
|
||||||
import { fileURLToPath } from 'url'
|
import { fileURLToPath } from 'node:url'
|
||||||
import { createRequire } from 'module'
|
import { createRequire } from 'node:module'
|
||||||
import { spawn } from 'child_process'
|
import { spawn } from 'node:child_process'
|
||||||
|
|
||||||
const pkg = createRequire(import.meta.url)('../package.json')
|
const pkg = createRequire(import.meta.url)('../package.json')
|
||||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||||
|
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
@ -22,7 +22,7 @@
|
|||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "Debug Main Process",
|
"name": "Debug Main Process",
|
||||||
"type": "pwa-node",
|
"type": "node",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
|
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
|
||||||
"windows": {
|
"windows": {
|
||||||
@ -39,7 +39,7 @@
|
|||||||
"name": "Debug Renderer Process",
|
"name": "Debug Renderer Process",
|
||||||
"port": 9229,
|
"port": 9229,
|
||||||
"request": "attach",
|
"request": "attach",
|
||||||
"type": "pwa-chrome",
|
"type": "chrome",
|
||||||
"timeout": 60000,
|
"timeout": 60000,
|
||||||
"skipFiles": [
|
"skipFiles": [
|
||||||
"<node_internals>/**",
|
"<node_internals>/**",
|
||||||
|
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@ -1,10 +1,11 @@
|
|||||||
{
|
{
|
||||||
"typescript.tsdk": "node_modules/typescript/lib",
|
"typescript.tsdk": "node_modules/typescript/lib",
|
||||||
"typescript.enablePromptUseWorkspaceTsdk": true,
|
"typescript.tsc.autoDetect": "off",
|
||||||
"json.schemas": [
|
"json.schemas": [
|
||||||
{
|
{
|
||||||
"fileMatch": [
|
"fileMatch": [
|
||||||
"/*electron-builder.json5"
|
"/*electron-builder.json5",
|
||||||
|
"/*electron-builder.json"
|
||||||
],
|
],
|
||||||
"url": "https://json.schemastore.org/electron-builder"
|
"url": "https://json.schemastore.org/electron-builder"
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ npm create electron-vite
|
|||||||
|
|
||||||
<!-- [](https://asciinema.org/a/483731) -->
|
<!-- [](https://asciinema.org/a/483731) -->
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Debug
|
## Debug
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
{
|
{
|
||||||
"appId": "YourAppID",
|
"appId": "YourAppID",
|
||||||
"asar": true,
|
"asar": true,
|
||||||
|
"icon": "public/favicon.ico",
|
||||||
"directories": {
|
"directories": {
|
||||||
"output": "release/${version}"
|
"output": "release/${version}"
|
||||||
},
|
},
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
import { app, BrowserWindow, shell, ipcMain } from 'electron'
|
||||||
|
import { release } from 'node:os'
|
||||||
|
import { join } from 'node:path'
|
||||||
|
|
||||||
// The built directory structure
|
// The built directory structure
|
||||||
//
|
//
|
||||||
// ├─┬ dist-electron
|
// ├─┬ dist-electron
|
||||||
@ -14,10 +18,6 @@ process.env.PUBLIC = process.env.VITE_DEV_SERVER_URL
|
|||||||
? join(process.env.DIST_ELECTRON, '../public')
|
? join(process.env.DIST_ELECTRON, '../public')
|
||||||
: process.env.DIST
|
: process.env.DIST
|
||||||
|
|
||||||
import { app, BrowserWindow, shell, ipcMain } from 'electron'
|
|
||||||
import { release } from 'os'
|
|
||||||
import { join } from 'path'
|
|
||||||
|
|
||||||
// Disable GPU Acceleration for Windows 7
|
// Disable GPU Acceleration for Windows 7
|
||||||
if (release().startsWith('6.1')) app.disableHardwareAcceleration()
|
if (release().startsWith('6.1')) app.disableHardwareAcceleration()
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ app.on('activate', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// New window example arg: new windows url
|
// New window example arg: new windows url
|
||||||
ipcMain.handle('open-win', (event, arg) => {
|
ipcMain.handle('open-win', (_, arg) => {
|
||||||
const childWindow = new BrowserWindow({
|
const childWindow = new BrowserWindow({
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload,
|
preload,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
function domReady(condition: DocumentReadyState[] = ['complete', 'interactive']) {
|
function domReady(condition: DocumentReadyState[] = ['complete', 'interactive']) {
|
||||||
return new Promise(resolve => {
|
return new Promise((resolve) => {
|
||||||
if (condition.includes(document.readyState)) {
|
if (condition.includes(document.readyState)) {
|
||||||
resolve(true)
|
resolve(true)
|
||||||
} else {
|
} else {
|
||||||
@ -85,7 +85,7 @@ function useLoading() {
|
|||||||
const { appendLoading, removeLoading } = useLoading()
|
const { appendLoading, removeLoading } = useLoading()
|
||||||
domReady().then(appendLoading)
|
domReady().then(appendLoading)
|
||||||
|
|
||||||
window.onmessage = ev => {
|
window.onmessage = (ev) => {
|
||||||
ev.data.payload === 'removeLoading' && removeLoading()
|
ev.data.payload === 'removeLoading' && removeLoading()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" href="/favicon.ico" />
|
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
|
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
|
||||||
<title>Vite App</title>
|
<title>Electron + Vite + Vue</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
47
package.json
47
package.json
@ -6,35 +6,32 @@
|
|||||||
"author": "草鞋没号 <308487730@qq.com>",
|
"author": "草鞋没号 <308487730@qq.com>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
|
||||||
"dev": "vite",
|
|
||||||
"build": "vue-tsc --noEmit && vite build && electron-builder"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "^14.18.0 || >=16.0.0"
|
|
||||||
},
|
|
||||||
"dependencies": {},
|
|
||||||
"devDependencies": {
|
|
||||||
"@vitejs/plugin-vue": "^4.0.0",
|
|
||||||
"electron": "^22.0.0",
|
|
||||||
"electron-builder": "^23.3.3",
|
|
||||||
"typescript": "^4.8.4",
|
|
||||||
"vite": "^4.0.0",
|
|
||||||
"vite-plugin-electron": "^0.11.1",
|
|
||||||
"vite-plugin-electron-renderer": "^0.11.3",
|
|
||||||
"vue": "^3.2.40",
|
|
||||||
"vue-tsc": "^1.0.9"
|
|
||||||
},
|
|
||||||
"debug": {
|
|
||||||
"env": {
|
|
||||||
"VITE_DEV_SERVER_URL": "http://127.0.0.1:3344"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"electron",
|
"electron",
|
||||||
"rollup",
|
"rollup",
|
||||||
"vite",
|
"vite",
|
||||||
"vue3",
|
"vue3",
|
||||||
"vue"
|
"vue"
|
||||||
]
|
],
|
||||||
|
"debug": {
|
||||||
|
"env": {
|
||||||
|
"VITE_DEV_SERVER_URL": "http://127.0.0.1:3344/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "vue-tsc --noEmit && vite build && electron-builder",
|
||||||
|
"preview": "vite preview"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@vitejs/plugin-vue": "^4.0.0",
|
||||||
|
"electron": "^22.0.0",
|
||||||
|
"electron-builder": "^23.6.0",
|
||||||
|
"typescript": "^4.9.4",
|
||||||
|
"vite": "^4.0.3",
|
||||||
|
"vite-plugin-electron": "^0.11.1",
|
||||||
|
"vite-plugin-electron-renderer": "^0.11.3",
|
||||||
|
"vue": "^3.2.45",
|
||||||
|
"vue-tsc": "^1.0.16"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 85 KiB |
BIN
public/node.png
BIN
public/node.png
Binary file not shown.
Before Width: | Height: | Size: 16 KiB |
1
public/node.svg
Normal file
1
public/node.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="216" height="216" viewBox="0 0 216 216"><path fill="#80bd01" d="M104.6 180.7c-2 0-3.9-.5-5.7-1.5l-18.1-10.7c-2.7-1.5-1.4-2-.5-2.4 3.6-1.2 4.3-1.5 8.2-3.7.4-.2.9-.1 1.3.1l13.9 8.2c.5.3 1.2.3 1.7 0l54.1-31.2c.5-.3.8-.9.8-1.5V75.7c0-.6-.3-1.2-.8-1.5l-54-31.2c-.5-.3-1.2-.3-1.7 0l-54 31.2c-.5.3-.9.9-.9 1.5v62.4c0 .6.3 1.2.9 1.4l14.8 8.6c8 4 13-.7 13-5.5V81c0-.9.7-1.6 1.6-1.6h6.9c.9 0 1.6.7 1.6 1.6v61.6c0 10.7-5.8 16.9-16 16.9-3.1 0-5.6 0-12.5-3.4L44.8 148c-3.5-2-5.7-5.8-5.7-9.9V75.7c0-4.1 2.2-7.8 5.7-9.9l54.1-31.2c3.4-1.9 8-1.9 11.4 0l54.1 31.2c3.5 2 5.7 5.8 5.7 9.9v62.4c0 4.1-2.2 7.8-5.7 9.9l-54.1 31.2c-1.8 1-3.7 1.5-5.7 1.5zm43.6-61.5c0-11.7-7.9-14.8-24.5-17-16.8-2.2-18.5-3.4-18.5-7.3 0-3.2 1.4-7.6 13.9-7.6 11.1 0 15.2 2.4 16.9 9.9.1.7.8 1.2 1.5 1.2h7c.4 0 .8-.2 1.1-.5.3-.3.5-.8.4-1.2-1.1-12.9-9.7-18.9-27-18.9-15.4 0-24.6 6.5-24.6 17.4 0 11.8 9.1 15.1 23.9 16.6 17.7 1.7 19.1 4.3 19.1 7.8 0 6-4.8 8.6-16.2 8.6-14.3 0-17.5-3.6-18.5-10.7-.1-.8-.8-1.3-1.6-1.3h-7c-.9 0-1.6.7-1.6 1.6 0 9.1 5 20 28.6 20 17.3-.1 27.1-6.8 27.1-18.6zM172 55.9V57h3v8h1.2v-8h3.1v-1.1H172zm8.4 9.1h1.2v-7.6l2.6 7.6h1.2l2.6-7.6V65h1.2v-9h-1.7l-2.6 7.6-2.6-7.6h-1.8v9z"/></svg>
|
After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
59
src/App.vue
59
src/App.vue
@ -1,67 +1,50 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
// This starter template is using Vue 3 <script setup> SFCs
|
|
||||||
// Check out https://vuejs.org/api/sfc-script-setup.html#script-setup
|
|
||||||
import HelloWorld from './components/HelloWorld.vue'
|
import HelloWorld from './components/HelloWorld.vue'
|
||||||
|
|
||||||
|
console.log("[App.vue]", `Hello world from Electron ${process.versions.electron}!`)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="logo-box">
|
<div>
|
||||||
<img class="logo vite" src="./assets/vite.svg" >
|
<a href="https://www.electronjs.org/" target="_blank">
|
||||||
<img class="logo electron" src="./assets/electron.svg" >
|
<img src="./assets/electron.svg" class="logo electron" alt="Electron logo" />
|
||||||
<img class="logo vue" src="./assets/vue.svg" >
|
</a>
|
||||||
|
<a href="https://vitejs.dev/" target="_blank">
|
||||||
|
<img src="/vite.svg" class="logo" alt="Vite logo" />
|
||||||
|
</a>
|
||||||
|
<a href="https://vuejs.org/" target="_blank">
|
||||||
|
<img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<HelloWorld msg="Hello Vue 3 + TypeScript + Vite" />
|
<HelloWorld msg="Electron + Vite + Vue" />
|
||||||
<div class="static-public">
|
<div class="flex-center">
|
||||||
Place static files into the <code>/public</code> folder
|
Place static files into the <code>/public</code> folder
|
||||||
<img style="width:77px;" :src="'./node.png'" >
|
<img style="width:5em;" src="/node.svg" alt="Node logo">
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
#app {
|
.flex-center {
|
||||||
font-family: Avenir, Helvetica, Arial, sans-serif;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
text-align: center;
|
|
||||||
color: #2c3e50;
|
|
||||||
margin-top: 60px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logo-box {
|
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.static-public {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.static-public code {
|
|
||||||
background-color: #eee;
|
|
||||||
padding: 2px 4px;
|
|
||||||
margin: 0 4px;
|
|
||||||
border-radius: 4px;
|
|
||||||
color: #304455;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
height: 6em;
|
height: 6em;
|
||||||
padding: 1.5em;
|
padding: 1.5em;
|
||||||
will-change: filter;
|
will-change: filter;
|
||||||
transition: 0.75s;
|
transition: filter 300ms;
|
||||||
}
|
|
||||||
|
|
||||||
.logo.vite:hover {
|
|
||||||
filter: drop-shadow(0 0 2em #646cffaa);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo.electron:hover {
|
.logo.electron:hover {
|
||||||
filter: drop-shadow(0 0 2em #9FEAF9);
|
filter: drop-shadow(0 0 2em #9FEAF9);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.logo:hover {
|
||||||
|
filter: drop-shadow(0 0 2em #646cffaa);
|
||||||
|
}
|
||||||
|
|
||||||
.logo.vue:hover {
|
.logo.vue:hover {
|
||||||
filter: drop-shadow(0 0 2em #42b883aa);
|
filter: drop-shadow(0 0 2em #42b883aa);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue'
|
||||||
|
import "./style.css"
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import './samples/node-api'
|
import './samples/node-api'
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { lstat } from 'fs/promises'
|
import { lstat } from 'node:fs/promises'
|
||||||
import { cwd } from 'process'
|
import { cwd } from 'node:process'
|
||||||
import { ipcRenderer } from 'electron'
|
import { ipcRenderer } from 'electron'
|
||||||
|
|
||||||
ipcRenderer.on('main-process-message', (_event, ...args) => {
|
ipcRenderer.on('main-process-message', (_event, ...args) => {
|
||||||
|
91
src/style.css
Normal file
91
src/style.css
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
:root {
|
||||||
|
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 24px;
|
||||||
|
font-weight: 400;
|
||||||
|
|
||||||
|
color-scheme: light dark;
|
||||||
|
color: rgba(255, 255, 255, 0.87);
|
||||||
|
background-color: #242424;
|
||||||
|
|
||||||
|
font-synthesis: none;
|
||||||
|
text-rendering: optimizeLegibility;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
-webkit-text-size-adjust: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
font-weight: 500;
|
||||||
|
color: #646cff;
|
||||||
|
text-decoration: inherit;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
color: #535bf2;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
display: flex;
|
||||||
|
place-items: center;
|
||||||
|
min-width: 320px;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 3.2em;
|
||||||
|
line-height: 1.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
padding: 0.6em 1.2em;
|
||||||
|
font-size: 1em;
|
||||||
|
font-weight: 500;
|
||||||
|
font-family: inherit;
|
||||||
|
background-color: #1a1a1a;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: border-color 0.25s;
|
||||||
|
}
|
||||||
|
button:hover {
|
||||||
|
border-color: #646cff;
|
||||||
|
}
|
||||||
|
button:focus,
|
||||||
|
button:focus-visible {
|
||||||
|
outline: 4px auto -webkit-focus-ring-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
background-color: #1a1a1a;
|
||||||
|
padding: 2px 4px;
|
||||||
|
margin: 0 4px;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
padding: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#app {
|
||||||
|
max-width: 1280px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 2rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: light) {
|
||||||
|
:root {
|
||||||
|
color: #213547;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
color: #747bff;
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
}
|
||||||
|
code {
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
}
|
||||||
|
}
|
1
src/env.d.ts → src/vite-env.d.ts
vendored
1
src/env.d.ts → src/vite-env.d.ts
vendored
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
declare module '*.vue' {
|
declare module '*.vue' {
|
||||||
import type { DefineComponent } from 'vue'
|
import type { DefineComponent } from 'vue'
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
|
|
||||||
const component: DefineComponent<{}, {}, any>
|
const component: DefineComponent<{}, {}, any>
|
||||||
export default component
|
export default component
|
||||||
}
|
}
|
@ -1,18 +1,17 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ESNext",
|
"target": "ESNext",
|
||||||
|
"useDefineForClassFields": true,
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "Node",
|
||||||
"importHelpers": true,
|
|
||||||
"jsx": "preserve",
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"resolveJsonModule": true,
|
|
||||||
"sourceMap": true,
|
|
||||||
"baseUrl": "./",
|
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"paths": {},
|
"jsx": "preserve",
|
||||||
"allowSyntheticDefaultImports": true,
|
"resolveJsonModule": true,
|
||||||
"skipLibCheck": true
|
"isolatedModules": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"lib": ["ESNext", "DOM"],
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"noEmit": true
|
||||||
},
|
},
|
||||||
"include": ["src"],
|
"include": ["src"],
|
||||||
"references": [
|
"references": [
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ESNext",
|
|
||||||
"composite": true,
|
"composite": true,
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"moduleResolution": "Node",
|
"moduleResolution": "Node",
|
||||||
"jsx": "preserve",
|
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"allowSyntheticDefaultImports": true
|
"allowSyntheticDefaultImports": true
|
||||||
},
|
},
|
||||||
"include": ["package.json", "electron"]
|
"include": ["vite.config.ts", "package.json", "electron"]
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,14 @@
|
|||||||
import { rmSync } from 'fs'
|
import { rmSync } from 'node:fs'
|
||||||
import {
|
import { defineConfig } from 'vite'
|
||||||
type Plugin,
|
|
||||||
defineConfig,
|
|
||||||
loadEnv,
|
|
||||||
} from 'vite'
|
|
||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
import electron from 'vite-plugin-electron'
|
import electron from 'vite-plugin-electron'
|
||||||
import renderer from 'vite-plugin-electron-renderer'
|
import renderer from 'vite-plugin-electron-renderer'
|
||||||
import pkg from './package.json'
|
import pkg from './package.json'
|
||||||
|
|
||||||
rmSync('dist-electron', { recursive: true, force: true })
|
rmSync('dist-electron', { recursive: true, force: true })
|
||||||
const sourcemap = !!process.env.VSCODE_DEBUG
|
|
||||||
const isBuild = process.argv.slice(2).includes('build')
|
const isDevelopment = process.env.NODE_ENV === "development" || !!process.env.VSCODE_DEBUG
|
||||||
|
const isProduction = process.env.NODE_ENV === "production"
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
@ -30,11 +27,11 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
vite: {
|
vite: {
|
||||||
build: {
|
build: {
|
||||||
sourcemap,
|
sourcemap: isDevelopment,
|
||||||
minify: isBuild,
|
minify: isProduction,
|
||||||
outDir: 'dist-electron/main',
|
outDir: 'dist-electron/main',
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
external: Object.keys(pkg.dependencies),
|
external: Object.keys("dependencies" in pkg ? pkg.dependencies : {}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -48,11 +45,11 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
vite: {
|
vite: {
|
||||||
build: {
|
build: {
|
||||||
sourcemap,
|
sourcemap: isDevelopment,
|
||||||
minify: isBuild,
|
minify: isProduction,
|
||||||
outDir: 'dist-electron/preload',
|
outDir: 'dist-electron/preload',
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
external: Object.keys(pkg.dependencies),
|
external: Object.keys("dependencies" in pkg ? pkg.dependencies : {}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -63,7 +60,7 @@ export default defineConfig({
|
|||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
server: process.env.VSCODE_DEBUG ? (() => {
|
server: !!process.env.VSCODE_DEBUG ? (() => {
|
||||||
const url = new URL(pkg.debug.env.VITE_DEV_SERVER_URL)
|
const url = new URL(pkg.debug.env.VITE_DEV_SERVER_URL)
|
||||||
return {
|
return {
|
||||||
host: url.hostname,
|
host: url.hostname,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user