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

Build-in support to create aliases to import or require modules would be very helpful #2191

doberkofler opened this issue Apr 19, 2022 · 5 comments


Copy link

doberkofler commented Apr 19, 2022

I currently evaluating the migration of a very very lange and complex webpack configuration to esbuild.
I have found some esbuild plugins but was not able to get things working and believe that build-in support for aliases similar to resolve.alias in webpack or paths in TypeScript would be a very helpful addition.

Copy link

evanw commented Apr 19, 2022

Yes, I agree. However, esbuild actually does support paths in tsconfig.json. It's respected in both TypeScript and JavaScript files while bundling.

Copy link

@evanw Interesting, but I'm not sure I fully understand. I would prefer to just rely use the build-in features but noticed, that esbuild did automatically resolve the TypeScript modules but not the css modules. Is this this the expected behavior or should also the css modules be resolved? Please also note, that I created a separate SR #2192 that specifically focuses on the module resolution when chaining plugins. Thank you for your awesome work.

Copy link

I also noticed that for example the dataurl loader needed to import image resources does not resolve accordingto the paths in tsconfig.json and does also not observe the alias set in the plugin esbuild-plugin-alias.

Copy link

It it supported only when bundling?
What about using esm without bundling?
The paths stay the same

Copy link

jsejcksn commented Nov 27, 2022

I just saw this mentioned in the latest release notes.

@evanw How is it different from / advantageous over supporting standard import maps?

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

No branches or pull requests

4 participants