mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-01-19 03:46:35 +08:00
refactor: better Debug
This commit is contained in:
parent
5b21e8f189
commit
ebb226e917
2
.vscode/.debug.script.mjs
vendored
2
.vscode/.debug.script.mjs
vendored
@ -8,7 +8,7 @@ const pkg = createRequire(import.meta.url)('../package.json')
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
// write .debug.env
|
||||
const envContent = Object.entries(pkg.env).map(([key, val]) => `${key}=${val}`)
|
||||
const envContent = Object.entries(pkg.debug.env).map(([key, val]) => `${key}=${val}`)
|
||||
fs.writeFileSync(path.join(__dirname, '.debug.env'), envContent.join('\n'))
|
||||
|
||||
// bootstrap
|
||||
|
@ -28,8 +28,7 @@ export const ROOT_PATH = {
|
||||
let win: BrowserWindow | null = null
|
||||
// Here, you can also use other preload
|
||||
const preload = join(__dirname, '../preload/index.js')
|
||||
// 🚧 Use ['ENV_NAME'] avoid vite:define plugin
|
||||
const url = `http://${process.env['VITE_DEV_SERVER_HOST']}:${process.env['VITE_DEV_SERVER_PORT']}`
|
||||
const url = process.env.VITE_DEV_SERVER_URL
|
||||
const indexHtml = join(ROOT_PATH.dist, 'index.html')
|
||||
|
||||
async function createWindow() {
|
||||
|
@ -23,9 +23,12 @@
|
||||
"vue": "^3.2.37",
|
||||
"vue-tsc": "^0.40.1"
|
||||
},
|
||||
"env": {
|
||||
"VITE_DEV_SERVER_HOST": "127.0.0.1",
|
||||
"VITE_DEV_SERVER_PORT": 3344
|
||||
"debug": {
|
||||
"env": {
|
||||
"VITE_DEV_SERVER_HOST": "127.0.0.1",
|
||||
"VITE_DEV_SERVER_PORT": 3344,
|
||||
"VITE_DEV_SERVER_URL": "http://127.0.0.1:3344"
|
||||
}
|
||||
},
|
||||
"keywords": [
|
||||
"electron",
|
||||
|
@ -42,8 +42,8 @@ export default defineConfig({
|
||||
renderer: {},
|
||||
}),
|
||||
],
|
||||
server: {
|
||||
host: pkg.env.VITE_DEV_SERVER_HOST,
|
||||
port: pkg.env.VITE_DEV_SERVER_PORT,
|
||||
},
|
||||
server: process.env.VSCODE_DEBUG ? {
|
||||
host: pkg.debug.env.VITE_DEV_SERVER_HOST,
|
||||
port: pkg.debug.env.VITE_DEV_SERVER_PORT,
|
||||
} : undefined,
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user