reactor: better debug.env
This commit is contained in:
1 parent
d5f251f5d1
commit
9b5a3a9c61
4 files changed
+12
-14
No files matched your search
Vendored
+1
-1
@@ -9,7 +9,7 @@ const require = createRequire(import.meta.url)
|
|||||||
const pkg = require('../package.json')
|
const pkg = require('../package.json')
|
||||||
|
|
||||||
// write .debug.env
|
// 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'))
|
fs.writeFileSync(path.join(__dirname, '.debug.env'), envContent.join('\n'))
|
||||||
|
|
||||||
// bootstrap
|
// bootstrap
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ export const ROOT_PATH = {
|
|||||||
let win: BrowserWindow | null = null
|
let win: BrowserWindow | null = null
|
||||||
// Here, you can also use other preload
|
// Here, you can also use other preload
|
||||||
const preload = join(__dirname, '../preload/index.js')
|
const preload = join(__dirname, '../preload/index.js')
|
||||||
// 🚧 Use ['ENV_NAME'] avoid vite:define plugin
|
const url = process.env.VITE_DEV_SERVER_URL
|
||||||
const url = process.env.VITE_DEV_SERVER_URL as string;
|
|
||||||
const indexHtml = join(ROOT_PATH.dist, 'index.html')
|
const indexHtml = join(ROOT_PATH.dist, 'index.html')
|
||||||
|
|
||||||
async function createWindow() {
|
async function createWindow() {
|
||||||
|
|||||||
+6
-4
@@ -28,9 +28,11 @@
|
|||||||
"vite": "^3.0.7",
|
"vite": "^3.0.7",
|
||||||
"vite-plugin-electron": "^0.9.1"
|
"vite-plugin-electron": "^0.9.1"
|
||||||
},
|
},
|
||||||
"env": {
|
"debug": {
|
||||||
"VITE_DEV_SERVER_HOST": "127.0.0.1",
|
"env": {
|
||||||
"VITE_DEV_SERVER_PORT": 7777,
|
"VITE_DEV_SERVER_HOST": "127.0.0.1",
|
||||||
"VITE_DEV_SERVER_URL": "http://127.0.0.1:7777"
|
"VITE_DEV_SERVER_PORT": 7777,
|
||||||
|
"VITE_DEV_SERVER_URL": "http://127.0.0.1:7777"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-7
@@ -48,11 +48,8 @@ export default defineConfig({
|
|||||||
renderer: {},
|
renderer: {},
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
server: {
|
server: process.env.VSCODE_DEBUG ? {
|
||||||
host: pkg.env.VITE_DEV_SERVER_HOST,
|
host: pkg.debug.env.VITE_DEV_SERVER_HOST,
|
||||||
port: pkg.env.VITE_DEV_SERVER_PORT,
|
port: pkg.debug.env.VITE_DEV_SERVER_PORT,
|
||||||
},
|
} : undefined,
|
||||||
build: {
|
|
||||||
minify: false
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
Reference in new issue
Block a user