From a12646f25e21d2aa82d04b820f0e9804eaf93322 Mon Sep 17 00:00:00 2001 From: alex8088 <244096523@qq.com> Date: Sat, 6 Jan 2024 11:33:53 +0800 Subject: [PATCH] fix: electorn's export subpaths also need to be externalized #372 --- src/plugins/electron.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/electron.ts b/src/plugins/electron.ts index 18b6897..3eb36d7 100644 --- a/src/plugins/electron.ts +++ b/src/plugins/electron.ts @@ -76,7 +76,7 @@ export function electronMainVitePlugin(options?: ElectronPluginOptions): Plugin[ target: nodeTarget, assetsDir: 'chunks', rollupOptions: { - external: ['electron', ...builtinModules.flatMap(m => [m, `node:${m}`])], + external: ['electron', /^electron\/.+/, ...builtinModules.flatMap(m => [m, `node:${m}`])], output: {} }, reportCompressedSize: false, @@ -203,7 +203,7 @@ export function electronPreloadVitePlugin(options?: ElectronPluginOptions): Plug target: nodeTarget, assetsDir: 'chunks', rollupOptions: { - external: ['electron', ...builtinModules.flatMap(m => [m, `node:${m}`])], + external: ['electron', /^electron\/.+/, ...builtinModules.flatMap(m => [m, `node:${m}`])], output: {} }, reportCompressedSize: false,