From 27acfb7c1d1b1e3f38049b4ac1dccc857735590b Mon Sep 17 00:00:00 2001 From: Yoni Rapoport Date: Tue, 15 Aug 2023 14:37:48 +0300 Subject: [PATCH] Support subpath imports from externalized dependencies Using an array of regular expressions for rollupOptions.external, I've fixed an issue causing subpath imports or external dependencies (e.g. import {} from 'pkg/subpath') to be bundled. --- src/plugins/externalizeDeps.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/externalizeDeps.ts b/src/plugins/externalizeDeps.ts index e475d89..0275c0b 100644 --- a/src/plugins/externalizeDeps.ts +++ b/src/plugins/externalizeDeps.ts @@ -33,7 +33,7 @@ export function externalizeDepsPlugin(options: ExternalOptions = {}): Plugin | n const defaultConfig = { build: { rollupOptions: { - external: [...new Set(deps)] + external: [...new Set(deps.map(d => new RegExp(`^${d}\/?.*`)))] } } }