@@ -230,8 +230,7 @@ function parsePackageName(specifier, base) {
230
230
}
231
231
232
232
function getPackageJSONURL ( specifier , base ) {
233
- const { packageName, packageSubpath, isScoped } =
234
- parsePackageName ( specifier , base ) ;
233
+ const { packageName, packageSubpath, isScoped } = parsePackageName ( specifier , base ) ;
235
234
236
235
// ResolveSelf
237
236
const packageConfig = getPackageScopeConfig ( base ) ;
@@ -242,8 +241,7 @@ function getPackageJSONURL(specifier, base) {
242
241
}
243
242
}
244
243
245
- let packageJSONUrl =
246
- new URL ( './node_modules/' + packageName + '/package.json' , base ) ;
244
+ let packageJSONUrl = new URL ( `./node_modules/${ packageName } /package.json` , base ) ;
247
245
let packageJSONPath = fileURLToPath ( packageJSONUrl ) ;
248
246
let lastPath ;
249
247
do {
@@ -254,9 +252,10 @@ function getPackageJSONURL(specifier, base) {
254
252
// Check for !stat.isDirectory()
255
253
if ( stat !== 1 ) {
256
254
lastPath = packageJSONPath ;
257
- packageJSONUrl = new URL ( ( isScoped ?
258
- '../../../../node_modules/' : '../../../node_modules/' ) +
259
- packageName + '/package.json' , packageJSONUrl ) ;
255
+ packageJSONUrl = new URL (
256
+ `${ isScoped ? '../' : '' } ../../../node_modules/${ packageName } /package.json` ,
257
+ packageJSONUrl ,
258
+ ) ;
260
259
packageJSONPath = fileURLToPath ( packageJSONUrl ) ;
261
260
continue ;
262
261
}
0 commit comments