From fc93d313fa6ebd4dcd167a1c0a5ab95310e1df1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=89=E9=9E=8B=E6=B2=A1=E5=8F=B7?= <308487730@qq.com> Date: Wed, 5 Jan 2022 09:09:16 +0800 Subject: [PATCH] feat: external dependencies --- configs/vite-main.config.ts | 4 +++- configs/vite-preload.config.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) 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',