lucacasonato / esbuild_deno_loader

Deno module resolution for `esbuild`
https://jsr.io/@luca/esbuild-deno-loader
MIT License
176 stars 46 forks source link

feat: support for `npm:` specifiers #67

Closed lucacasonato closed 1 year ago

lucacasonato commented 1 year ago

This commit adds support for NPM specifiers, when using a native build of esbuild (not the WASM build!). Both Deno's global resolver (that does not use node_modules), and the resolver using the local node_modules/ folder are supported.

When using the native loader, the global resolver is used by default. The nodeModulesDir option can be used to switch to the local resolver. When this option is enabled, a node_modules/ folder is automatically generated, as if one had passed --node-modules-dir to deno run.

In the portable loader, the global resolver is unsupported. The nodeModulesDir option MUST be specified here to support npm: resolution. A node_modules/ directory must have been generated up-front using deno cache --node-modules-dir <entrypoint>, or similar.

Closes #56 Closes #29

zookatron commented 1 year ago

Thanks @lucacasonato ! Would you be open to PRs that add support for NPM specifiers when using the WASM build or do you think there are structural reasons why this is not a good idea?

lucacasonato commented 1 year ago

Not principally objected no. The easiest path forward is to contribute FS APIs for WASM to esbuild.