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

Rewrite bare js imports to resolve to node_modules. #56

Open
hayleigh-dot-dev opened this issue Jul 19, 2024 · 0 comments
Open

Rewrite bare js imports to resolve to node_modules. #56

hayleigh-dot-dev opened this issue Jul 19, 2024 · 0 comments

Comments

@hayleigh-dot-dev
Copy link
Contributor

We recently ran into a question where someone was struggling to import a file like import whatever from 'some-package' in their ffi code. Users coming from other js bundlers will expect imports like this to work automatically, and folks using dev-tools for bundling but still using npm to access the js ecosystem will run into this problem every time.

If we were using the npm version of esbuild we could use the node resolution plugin, but because we're using the standalone version we are going to have to work on the js ffi files directly.

Node calls these kinds of imports that are not relative or absolute, "bare" imports. And the rules for how they are resolved are outlined in https://nodejs.org/api/packages.html#package-entry-points. It would be great if we would rewrite these bare imports into ones that resolved to node_modules correctly before running esbuild.

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

1 participant