From 656519cd681658073d158e4a99452277aa9be44d Mon Sep 17 00:00:00 2001 From: oceanlvr <657531018@qq.com> Date: Sun, 13 Feb 2022 15:52:05 +0800 Subject: [PATCH] feat: add vscode debug file --- .gitignore | 1 - .vscode/launch.json | 44 ++++++++++++++++++++++++++++++++++++ package.json | 4 +++- packages/main/vite.config.ts | 3 ++- 4 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.gitignore b/.gitignore index afecd9e..48efe2f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,3 @@ dist-ssr tmp **/.tmp release -.vscode diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..5149ca0 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,44 @@ + + +{ + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Main", + "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron", + // "program": "${workspaceRoot}/packages/main/index.ts", + // "outFiles": [ + // "${workspaceRoot}/dist/main/index.cjs" + // ], + "runtimeArgs": [ + "./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", + "url": "http://localhost:3344", + "webRoot": "${workspaceFolder}/packages/renderer", + }, + ], + "compounds": [ + { + "name": "All", + "configurations": [ + "Renderer", + "Main", + ] + } + ] +} diff --git a/package.json b/package.json index 17674aa..bfbcfb8 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,9 @@ "license": "MIT", "scripts": { "dev": "node scripts/watch.mjs", - "build": "vue-tsc --project packages/renderer/tsconfig.json --noEmit && node scripts/build.mjs && electron-builder" + "prebuild": "vue-tsc --project packages/renderer/tsconfig.json --noEmit && node scripts/build.mjs", + "build": "npm run prebuild && electron-builder", + "debug": "npm run prebuild && vite ./packages/renderer" }, "engines": { "node": ">=14.17.0" diff --git a/packages/main/vite.config.ts b/packages/main/vite.config.ts index c415c0c..ae9c78e 100644 --- a/packages/main/vite.config.ts +++ b/packages/main/vite.config.ts @@ -11,7 +11,8 @@ export default defineConfig({ formats: ['cjs'], fileName: () => '[name].cjs', }, - minify: process.env./* from mode option */NODE_ENV === 'production', + minify: false, + sourcemap: true, emptyOutDir: true, rollupOptions: { external: [