@@ -232,35 +232,33 @@ function nodeExternals(options: ExternalsOptions = {}): Plugin {
232232 include . push ( new RegExp ( '^(?:' + names . join ( '|' ) + ')(?:/.+)?$' ) )
233233 } ,
234234
235- resolveId : {
236- async handler ( specifier , importer , { isEntry } ) {
237- if (
238- isEntry // Ignore entry points
239- || / ^ (?: \0 | \. { 1 , 2 } \/ ) / . test ( specifier ) // Ignore virtual modules and relative imports
240- || path . isAbsolute ( specifier ) // Ignore already resolved ids
241- ) {
242- return null
243- }
235+ resolveId ( specifier , _ , { isEntry } ) {
236+ if (
237+ isEntry // Ignore entry points
238+ || / ^ (?: \0 | \. { 1 , 2 } \/ ) / . test ( specifier ) // Ignore virtual modules and relative imports
239+ || path . isAbsolute ( specifier ) // Ignore already resolved ids
240+ ) {
241+ return null
242+ }
244243
245- // Handle node builtins.
246- if ( isBuiltin ( specifier ) ) {
247- const stripped = specifier . replace ( / ^ n o d e : / , '' )
248- return {
249- id : config . builtinsPrefix === 'ignore'
250- ? specifier
251- : config . builtinsPrefix === 'add' || ! isBuiltin ( stripped )
252- ? 'node:' + stripped
253- : stripped ,
254- external : ( config . builtins || isIncluded ( specifier ) ) && ! isExcluded ( specifier ) ,
255- moduleSideEffects : false
256- }
244+ // Handle node builtins.
245+ if ( isBuiltin ( specifier ) ) {
246+ const stripped = specifier . replace ( / ^ n o d e : / , '' )
247+ return {
248+ id : config . builtinsPrefix === 'ignore'
249+ ? specifier
250+ : config . builtinsPrefix === 'add' || ! isBuiltin ( stripped )
251+ ? 'node:' + stripped
252+ : stripped ,
253+ external : ( config . builtins || isIncluded ( specifier ) ) && ! isExcluded ( specifier ) ,
254+ moduleSideEffects : false
257255 }
258-
259- // Handle npm dependencies.
260- return isIncluded ( specifier ) && ! isExcluded ( specifier )
261- ? false // external
262- : null // normal handling
263256 }
257+
258+ // Handle npm dependencies.
259+ return isIncluded ( specifier ) && ! isExcluded ( specifier )
260+ ? false // external
261+ : null // normal handling
264262 }
265263 } as ViteCompatiblePlugin
266264}
0 commit comments