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

Support "npm:" scheme #34

Open
tjosepo opened this issue Sep 10, 2023 · 2 comments
Open

Support "npm:" scheme #34

tjosepo opened this issue Sep 10, 2023 · 2 comments

Comments

@tjosepo
Copy link

tjosepo commented Sep 10, 2023

Currently, deno_cache only supports URL imports.

The only way to add an npm: module to Deno's cache is to:

  • Import it with a static import. Not ideal since it forces you to execute the package's code which does not make sense for front-end packages.
  • Use a package.json file.

It's also difficult to get the source code of npm: modules, unless the "nodeModulesDir" option is enabled.

Supporting npm: scheme or finding alternative ways to cache and obtain the source code of npm: modules that don't rely on the node_modules folder or the package.json file could enable better Deno-first tooling.

@garethj2
Copy link

garethj2 commented Jun 14, 2024

I've just stumbled across this as well.

I've been trying to build an application that uses the popular oak web server. The latest version of oak has an npm dependency (npm:[email protected]). This causes deno emit (and anything that requires a cache) to fail...

https://jsr.io/@oak/oak/16.1.0/deps.ts

Considering the widespread support for jsr and npm, I've very surprised this has been left out here.

Also note there doesn't appear to be any support for the node scheme either.

For more information, please see this issue created for Oak. This issue also covers dynamic imports...

oakserver/oak#660 (comment)

@dgreensp
Copy link

I'm using Rollup in my Deno project, and it sure would be nice to be able to use Deno's npm: specifiers.

It looks like there's some promising code under the name es_build_loader, and this fork: https://jsr.io/@duesabati/esbuild-deno-plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants