Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPM packages are incorrectly assumed to have downloaded into the registry.npmjs.org cache #139

Closed
jakesgordon opened this issue Aug 27, 2024 · 5 comments · Fixed by #143
Closed
Labels
bug Something isn't working

Comments

@jakesgordon
Copy link

The esbuild_deno_loader assumes that NPM packages are in a deno cache sub folder named registry.npmjs.org - (see hard coded value here)

Unfortunately this assumption breaks now that Deno supports private NPM packages via an .npmrc file (see release notes) where the registry name is likely to be different (e.g. npm.pkg.github.com)

Are there any plans to support alternative registries, or any obvious workarounds that might make this work?

Background

I have a private NPM package in the GitHub NPM registry so I use an .npmrc file that looks like this...

registry=https://registry.npmjs.org/
MY-PACKAGE:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=${NPM_TOKEN}

A regular Deno import { foo } from "MY-PACKAGE works fine, and Deno downloads the package into ~/.cache/deno/npm/npm.pkg.github.com/MY-PACKAGE

... but if I try to bundle it with the esbuild_deno_loader it throws an error because it assumes the source is in ~/.cache/deno/npm/registry.npmjs.org/MY-PACKAGE

✘ [ERROR] No such file or directory (os error 2): stat '/home/jake/.cache/deno/npm/registry.npmjs.org/@MY-PACKAGE/0.0.1' [plugin deno-loader]
@gavares
Copy link

gavares commented Oct 2, 2024

@lucacasonato - I just hit the same issue only to find that you made a fix 5 days ago. I was trying to find an RC that might have your change in place. I've tried 0.11.0-rc.1 but I think that still has the same problem. Is there another RC I might be able to use?

@lucacasonato
Copy link
Owner

Unfortunately not yet. There is a paired change in the Deno CLI that needs to land first.

@lucacasonato
Copy link
Owner

lucacasonato commented Oct 14, 2024

In the next release of this library this will start working if you use a canary release of Deno. It should be available in the next regular deno patch release.

@jakesgordon
Copy link
Author

Fantastic. Thank you!

@lucacasonato
Copy link
Owner

This is now working in Deno 2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants