File tree 2 files changed +13
-8
lines changed
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'
4
4
import { pathToFileURL } from 'node:url'
5
5
import { promisify } from 'node:util'
6
6
import { performance } from 'node:perf_hooks'
7
- import { builtinModules , createRequire } from 'node:module'
7
+ import { createRequire } from 'node:module'
8
8
import colors from 'picocolors'
9
9
import type { Alias , AliasOptions } from 'dep-types/alias'
10
10
import { build } from 'esbuild'
@@ -621,7 +621,7 @@ export const configDefaults = Object.freeze({
621
621
dedupe : [ ] ,
622
622
/** @experimental */
623
623
noExternal : [ ] ,
624
- // external
624
+ external : [ ] ,
625
625
preserveSymlinks : false ,
626
626
alias : [ ] ,
627
627
} ,
@@ -882,10 +882,7 @@ function resolveEnvironmentResolveOptions(
882
882
consumer === 'client' || isSsrTargetWebworkerEnvironment
883
883
? DEFAULT_CLIENT_CONDITIONS
884
884
: DEFAULT_SERVER_CONDITIONS . filter ( ( c ) => c !== 'browser' ) ,
885
- external :
886
- consumer === 'server' && ! isSsrTargetWebworkerEnvironment
887
- ? builtinModules
888
- : [ ] ,
885
+ enableBuiltinNoExternalCheck : ! ! isSsrTargetWebworkerEnvironment ,
889
886
} ,
890
887
resolve ?? { } ,
891
888
)
Original file line number Diff line number Diff line change @@ -96,6 +96,10 @@ export interface EnvironmentResolveOptions {
96
96
* @experimental
97
97
*/
98
98
external ?: string [ ] | true
99
+ /**
100
+ * @internal
101
+ */
102
+ enableBuiltinNoExternalCheck ?: boolean
99
103
}
100
104
101
105
export interface ResolveOptions extends EnvironmentResolveOptions {
@@ -169,8 +173,11 @@ interface ResolvePluginOptions {
169
173
}
170
174
171
175
export 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
+ }
174
181
175
182
// Defined ResolveOptions are used to overwrite the values for all environments
176
183
// It is used when creating custom resolvers (for CSS, scanning, etc)
@@ -420,6 +427,7 @@ export function resolvePlugin(
420
427
if ( isBuiltin ( id ) ) {
421
428
if ( currentEnvironmentOptions . consumer === 'server' ) {
422
429
if (
430
+ options . enableBuiltinNoExternalCheck &&
423
431
options . noExternal === true &&
424
432
// if both noExternal and external are true, noExternal will take the higher priority and bundle it.
425
433
// 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