mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-01-31 12:06:40 +08:00
feat: add inspector node debug support
This commit is contained in:
parent
f0424cbc4c
commit
9c902494a1
59
.vscode/launch.json
vendored
59
.vscode/launch.json
vendored
@ -1,23 +1,17 @@
|
||||
|
||||
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Main",
|
||||
"name": "Main(inspector)",
|
||||
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
|
||||
// "program": "${workspaceRoot}/packages/main/index.ts",
|
||||
// "outFiles": [
|
||||
// "${workspaceRoot}/dist/main/index.cjs"
|
||||
// ],
|
||||
"runtimeArgs": [
|
||||
"./dist/main/index.cjs",
|
||||
"--remote-debugging-port=9222",
|
||||
"${workspaceFolder}/dist/main/index.cjs",
|
||||
],
|
||||
"env": {
|
||||
"VITE_DEV_SERVER_HOST": "127.0.0.1",
|
||||
"VITE_DEV_SERVER_PORT": "3344"
|
||||
"DEBUG": "true",
|
||||
},
|
||||
"windows": {
|
||||
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
|
||||
@ -27,18 +21,51 @@
|
||||
{
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"name": "Renderer",
|
||||
"name": "Renderer(inspector)",
|
||||
"url": "http://localhost:9222",
|
||||
"webRoot": "${workspaceFolder}/dist/packages/renderer",
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Main(vite)",
|
||||
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
|
||||
"runtimeArgs": [
|
||||
"${workspaceFolder}/dist/main/index.cjs",
|
||||
],
|
||||
"env": {
|
||||
"VITE_DEV_SERVER_HOST": "127.0.0.1",
|
||||
"VITE_DEV_SERVER_PORT": "3344",
|
||||
},
|
||||
"windows": {
|
||||
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
|
||||
},
|
||||
"sourceMaps": true
|
||||
},
|
||||
{
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"name": "Renderer(vite)",
|
||||
"url": "http://localhost:3344",
|
||||
"webRoot": "${workspaceFolder}/packages/renderer",
|
||||
},
|
||||
],
|
||||
"compounds": [
|
||||
{
|
||||
"name": "All",
|
||||
"name": "All(inspector)",
|
||||
"configurations": [
|
||||
"Renderer",
|
||||
"Main",
|
||||
]
|
||||
"Renderer(inspector)",
|
||||
"Main(inspector)",
|
||||
],
|
||||
"preLaunchTask": "npm: prebuild"
|
||||
},
|
||||
{
|
||||
"name": "All(vite serve)",
|
||||
"configurations": [
|
||||
"Renderer(vite)",
|
||||
"Main(vite)",
|
||||
],
|
||||
"preLaunchTask": "npm: debug"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
21
.vscode/tasks.json
vendored
Normal file
21
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "prebuild",
|
||||
"group": "build",
|
||||
"problemMatcher": [],
|
||||
"label": "npm: prebuild",
|
||||
"detail": "vue-tsc --project packages/renderer/tsconfig.json --noEmit && node scripts/build.mjs"
|
||||
},
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "debug",
|
||||
"problemMatcher": [],
|
||||
"label": "npm: debug",
|
||||
"detail": "npm run prebuild && vite ./packages/renderer",
|
||||
"group": "build"
|
||||
},
|
||||
]
|
||||
}
|
@ -23,7 +23,7 @@ async function createWindow() {
|
||||
},
|
||||
})
|
||||
|
||||
if (app.isPackaged) {
|
||||
if (app.isPackaged || process.env["DEBUG"]) {
|
||||
win.loadFile(join(__dirname, '../renderer/index.html'))
|
||||
} else {
|
||||
// 🚧 Use ['ENV_NAME'] avoid vite:define plugin
|
||||
|
@ -11,7 +11,7 @@ export default defineConfig({
|
||||
formats: ['cjs'],
|
||||
fileName: () => '[name].cjs',
|
||||
},
|
||||
minify: false,
|
||||
minify: process.env./* from mode option */NODE_ENV === 'production',
|
||||
sourcemap: true,
|
||||
emptyOutDir: true,
|
||||
rollupOptions: {
|
||||
|
@ -11,6 +11,7 @@ export default defineConfig({
|
||||
formats: ['cjs'],
|
||||
fileName: () => '[name].cjs',
|
||||
},
|
||||
sourcemap: true,
|
||||
minify: process.env./* from mode option */NODE_ENV === 'production',
|
||||
emptyOutDir: true,
|
||||
rollupOptions: {
|
||||
|
@ -25,6 +25,7 @@ export default defineConfig({
|
||||
base: './',
|
||||
build: {
|
||||
emptyOutDir: true,
|
||||
sourcemap: true,
|
||||
outDir: '../../dist/renderer',
|
||||
},
|
||||
server: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user