@@ -152,7 +152,6 @@ function nodeExternals(options: ExternalsOptions = {}): Plugin {
152
152
result . push ( new RegExp ( '^' + entry . replace ( / [ . * + ? ^ $ { } ( ) | [ \] \\ ] / g, '\\$&' ) + '$' ) )
153
153
else if ( entry )
154
154
this . warn ( `Ignoring wrong entry type #${ index } in '${ option } ' option: ${ JSON . stringify ( entry ) } ` )
155
-
156
155
return result
157
156
} , [ ] as RegExp [ ] )
158
157
)
@@ -165,7 +164,7 @@ function nodeExternals(options: ExternalsOptions = {}): Plugin {
165
164
. filter ( isString )
166
165
. map ( packagePath => path . resolve ( packagePath ) )
167
166
if ( packagePaths . length === 0 ) {
168
- loop : for (
167
+ search : for (
169
168
let current = process . cwd ( ) , previous : string | undefined = undefined ;
170
169
previous !== current ;
171
170
previous = current , current = path . dirname ( current )
@@ -176,16 +175,18 @@ function nodeExternals(options: ExternalsOptions = {}): Plugin {
176
175
if ( stat ?. isFile ( ) )
177
176
packagePaths . push ( name )
178
177
179
- // Break early is this is a git repo or there is a known workspace root file .
178
+ // Break early if we are at the root of a git repo .
180
179
name = path . join ( current , '.git' )
181
180
stat = await fs . stat ( name ) . catch ( ( ) => null )
182
181
if ( stat ?. isDirectory ( ) )
183
182
break
183
+
184
+ // Break early is there is a known workspace root file.
184
185
for ( const file of workspaceRootFiles ) {
185
186
name = path . join ( current , file )
186
187
stat = await fs . stat ( name ) . catch ( ( ) => null )
187
188
if ( stat ?. isFile ( ) )
188
- break loop
189
+ break search
189
190
}
190
191
}
191
192
}
@@ -233,9 +234,9 @@ function nodeExternals(options: ExternalsOptions = {}): Plugin {
233
234
234
235
resolveId : {
235
236
order : 'pre' ,
236
- async handler ( specifier , importer , { isEntry } ) {
237
+ async handler ( specifier , _ , { isEntry } ) {
237
238
if (
238
- isEntry // Ignore entry points (they should always be resolved)
239
+ isEntry // Ignore entry points
239
240
|| / ^ (?: \0 | \. { 1 , 2 } \/ ) / . test ( specifier ) // Ignore virtual modules and relative imports
240
241
|| path . isAbsolute ( specifier ) // Ignore already resolved ids
241
242
) {
0 commit comments