File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed
Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import path from 'node:path'
44import { pathToFileURL } from 'node:url'
55import { promisify } from 'node:util'
66import { performance } from 'node:perf_hooks'
7- import { builtinModules , createRequire } from 'node:module'
7+ import { createRequire } from 'node:module'
88import colors from 'picocolors'
99import type { Alias , AliasOptions } from 'dep-types/alias'
1010import { build } from 'esbuild'
@@ -621,7 +621,7 @@ export const configDefaults = Object.freeze({
621621 dedupe : [ ] ,
622622 /** @experimental */
623623 noExternal : [ ] ,
624- // external
624+ external : [ ] ,
625625 preserveSymlinks : false ,
626626 alias : [ ] ,
627627 } ,
@@ -882,10 +882,7 @@ function resolveEnvironmentResolveOptions(
882882 consumer === 'client' || isSsrTargetWebworkerEnvironment
883883 ? DEFAULT_CLIENT_CONDITIONS
884884 : DEFAULT_SERVER_CONDITIONS . filter ( ( c ) => c !== 'browser' ) ,
885- external :
886- consumer === 'server' && ! isSsrTargetWebworkerEnvironment
887- ? builtinModules
888- : [ ] ,
885+ enableBuiltinNoExternalCheck : ! ! isSsrTargetWebworkerEnvironment ,
889886 } ,
890887 resolve ?? { } ,
891888 )
Original file line number Diff line number Diff line change @@ -96,6 +96,10 @@ export interface EnvironmentResolveOptions {
9696 * @experimental
9797 */
9898 external ?: string [ ] | true
99+ /**
100+ * @internal
101+ */
102+ enableBuiltinNoExternalCheck ?: boolean
99103}
100104
101105export interface ResolveOptions extends EnvironmentResolveOptions {
@@ -169,8 +173,11 @@ interface ResolvePluginOptions {
169173}
170174
171175export interface InternalResolveOptions
172- extends Required < ResolveOptions > ,
173- ResolvePluginOptions { }
176+ extends Required < Omit < ResolveOptions , 'enableBuiltinNoExternalCheck' > > ,
177+ ResolvePluginOptions {
178+ /** @internal this is always optional for backward compat */
179+ enableBuiltinNoExternalCheck ?: boolean
180+ }
174181
175182// Defined ResolveOptions are used to overwrite the values for all environments
176183// It is used when creating custom resolvers (for CSS, scanning, etc)
@@ -420,6 +427,7 @@ export function resolvePlugin(
420427 if ( isBuiltin ( id ) ) {
421428 if ( currentEnvironmentOptions . consumer === 'server' ) {
422429 if (
430+ options . enableBuiltinNoExternalCheck &&
423431 options . noExternal === true &&
424432 // if both noExternal and external are true, noExternal will take the higher priority and bundle it.
425433 // only if the id is explicitly listed in external, we will externalize it and skip this error.
You can’t perform that action at this time.
0 commit comments