mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-01-31 20:16:36 +08:00
feat: add inspector node debug support
This commit is contained in:
parent
f0424cbc4c
commit
9c902494a1
57
.vscode/launch.json
vendored
57
.vscode/launch.json
vendored
@ -1,23 +1,17 @@
|
|||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"type": "node",
|
"type": "node",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "Main",
|
"name": "Main(inspector)",
|
||||||
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
|
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
|
||||||
// "program": "${workspaceRoot}/packages/main/index.ts",
|
|
||||||
// "outFiles": [
|
|
||||||
// "${workspaceRoot}/dist/main/index.cjs"
|
|
||||||
// ],
|
|
||||||
"runtimeArgs": [
|
"runtimeArgs": [
|
||||||
"./dist/main/index.cjs",
|
"--remote-debugging-port=9222",
|
||||||
|
"${workspaceFolder}/dist/main/index.cjs",
|
||||||
],
|
],
|
||||||
"env": {
|
"env": {
|
||||||
"VITE_DEV_SERVER_HOST": "127.0.0.1",
|
"DEBUG": "true",
|
||||||
"VITE_DEV_SERVER_PORT": "3344"
|
|
||||||
},
|
},
|
||||||
"windows": {
|
"windows": {
|
||||||
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
|
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
|
||||||
@ -27,18 +21,51 @@
|
|||||||
{
|
{
|
||||||
"type": "chrome",
|
"type": "chrome",
|
||||||
"request": "launch",
|
"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",
|
"url": "http://localhost:3344",
|
||||||
"webRoot": "${workspaceFolder}/packages/renderer",
|
"webRoot": "${workspaceFolder}/packages/renderer",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"compounds": [
|
"compounds": [
|
||||||
{
|
{
|
||||||
"name": "All",
|
"name": "All(inspector)",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
"Renderer",
|
"Renderer(inspector)",
|
||||||
"Main",
|
"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'))
|
win.loadFile(join(__dirname, '../renderer/index.html'))
|
||||||
} else {
|
} else {
|
||||||
// 🚧 Use ['ENV_NAME'] avoid vite:define plugin
|
// 🚧 Use ['ENV_NAME'] avoid vite:define plugin
|
||||||
|
@ -11,7 +11,7 @@ export default defineConfig({
|
|||||||
formats: ['cjs'],
|
formats: ['cjs'],
|
||||||
fileName: () => '[name].cjs',
|
fileName: () => '[name].cjs',
|
||||||
},
|
},
|
||||||
minify: false,
|
minify: process.env./* from mode option */NODE_ENV === 'production',
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
emptyOutDir: true,
|
emptyOutDir: true,
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
|
@ -11,6 +11,7 @@ export default defineConfig({
|
|||||||
formats: ['cjs'],
|
formats: ['cjs'],
|
||||||
fileName: () => '[name].cjs',
|
fileName: () => '[name].cjs',
|
||||||
},
|
},
|
||||||
|
sourcemap: true,
|
||||||
minify: process.env./* from mode option */NODE_ENV === 'production',
|
minify: process.env./* from mode option */NODE_ENV === 'production',
|
||||||
emptyOutDir: true,
|
emptyOutDir: true,
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
|
@ -25,6 +25,7 @@ export default defineConfig({
|
|||||||
base: './',
|
base: './',
|
||||||
build: {
|
build: {
|
||||||
emptyOutDir: true,
|
emptyOutDir: true,
|
||||||
|
sourcemap: true,
|
||||||
outDir: '../../dist/renderer',
|
outDir: '../../dist/renderer',
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user