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.
This commit is contained in:
Yoni Rapoport 2023-08-15 14:37:48 +03:00 committed by GitHub
parent 5c440a8a76
commit 27acfb7c1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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}\/?.*`)))]
}
}
}