Closed lucacasonato closed 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?
Not principally objected no. The easiest path forward is to contribute FS APIs for WASM to esbuild.
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, anode_modules/
folder is automatically generated, as if one had passed--node-modules-dir
todeno run
.In the portable loader, the global resolver is unsupported. The
nodeModulesDir
option MUST be specified here to supportnpm:
resolution. Anode_modules/
directory must have been generated up-front usingdeno cache --node-modules-dir <entrypoint>
, or similar.Closes #56 Closes #29