File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -219,7 +219,8 @@ async function resolveModule(
219
219
220
220
// Fetch package on npm
221
221
pkgVersion = pkgVersion || 'latest'
222
- const registry = getRegistry ( )
222
+ const registry = getRegistryFromNpmrc ( )
223
+ setCorepackNpmRegistry ( registry )
223
224
const pkg = await $fetch (
224
225
`${ registry } /${ pkgName } /${ pkgVersion } ` ,
225
226
)
@@ -253,7 +254,7 @@ async function resolveModule(
253
254
}
254
255
}
255
256
256
- function getRegistry ( ) {
257
+ function getRegistryFromNpmrc ( ) {
257
258
const npmrcPath = join ( homedir ( ) , '.npmrc' )
258
259
if ( fs . existsSync ( npmrcPath ) ) {
259
260
const npmrcContent = fs . readFileSync ( npmrcPath , 'utf-8' )
@@ -262,3 +263,9 @@ function getRegistry() {
262
263
}
263
264
return 'https://registry.npmjs.org' // default registry
264
265
}
266
+
267
+ function setCorepackNpmRegistry ( registry : string ) {
268
+ if ( ! process . env . COREPACK_NPM_REGISTRY ) {
269
+ process . env . COREPACK_NPM_REGISTRY = registry ? registry : ''
270
+ }
271
+ }
You can’t perform that action at this time.
0 commit comments