@@ -219,8 +219,7 @@ function parsePackageName(specifier, base) {
219
219
}
220
220
221
221
function getPackageJSONURL ( specifier , base ) {
222
- const { packageName, packageSubpath, isScoped } =
223
- parsePackageName ( specifier , base ) ;
222
+ const { packageName, packageSubpath, isScoped } = parsePackageName ( specifier , base ) ;
224
223
225
224
// ResolveSelf
226
225
const packageConfig = getPackageScopeConfig ( base ) ;
@@ -231,8 +230,7 @@ function getPackageJSONURL(specifier, base) {
231
230
}
232
231
}
233
232
234
- let packageJSONUrl =
235
- new URL ( './node_modules/' + packageName + '/package.json' , base ) ;
233
+ let packageJSONUrl = new URL ( `./node_modules/${ packageName } /package.json` , base ) ;
236
234
let packageJSONPath = fileURLToPath ( packageJSONUrl ) ;
237
235
let lastPath ;
238
236
do {
@@ -243,9 +241,10 @@ function getPackageJSONURL(specifier, base) {
243
241
// Check for !stat.isDirectory()
244
242
if ( stat !== 1 ) {
245
243
lastPath = packageJSONPath ;
246
- packageJSONUrl = new URL ( ( isScoped ?
247
- '../../../../node_modules/' : '../../../node_modules/' ) +
248
- packageName + '/package.json' , packageJSONUrl ) ;
244
+ packageJSONUrl = new URL (
245
+ `${ isScoped ? '../' : '' } ../../../node_modules/${ packageName } /package.json` ,
246
+ packageJSONUrl ,
247
+ ) ;
249
248
packageJSONPath = fileURLToPath ( packageJSONUrl ) ;
250
249
continue ;
251
250
}
0 commit comments