diff --git a/configs/vite-main.config.ts b/configs/vite-main.config.ts index 47e4584..b91aa91 100644 --- a/configs/vite-main.config.ts +++ b/configs/vite-main.config.ts @@ -1,6 +1,7 @@ import { join } from 'path' import { builtinModules } from 'module' import { defineConfig } from 'vite' +import pkg from '../package.json' export default defineConfig({ mode: process.env.NODE_ENV, @@ -15,8 +16,9 @@ export default defineConfig({ emptyOutDir: true, rollupOptions: { external: [ - ...builtinModules, 'electron', + ...builtinModules, + ...Object.keys((pkg as Record).dependencies || {}), ], output: { entryFileNames: '[name].cjs', diff --git a/configs/vite-preload.config.ts b/configs/vite-preload.config.ts index e750d1e..7bed999 100644 --- a/configs/vite-preload.config.ts +++ b/configs/vite-preload.config.ts @@ -1,6 +1,7 @@ import { join } from 'path' import { builtinModules } from 'module' import { defineConfig } from 'vite' +import pkg from '../package.json' export default defineConfig({ mode: process.env.NODE_ENV, @@ -15,8 +16,9 @@ export default defineConfig({ emptyOutDir: true, rollupOptions: { external: [ - ...builtinModules, 'electron', + ...builtinModules, + ...Object.keys((pkg as Record).dependencies || {}), ], output: { entryFileNames: '[name].cjs',