You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say you're developing a browser app. It has two entry points - index.js and worker.js - both of which import many modules so you use Bun.build to bundle them.
But then there are some modules that you don't want to bundle - you want them to remain external - so you add them to the external array.
And then in production you use an import map to resolve these external modules.
But because your browser app has a (module) worker, there's an issue - import maps are not available in workers.
So this is where this proposal comes in.
What is the feature you are proposing to solve the problem?
An importmap option that accepts import map object through which the bundler would map and rewrite module specifiers.
It would act like the currently existing external option but with the added capability to rewrite module specifiers.
If the same module specifier is provided both in external and importmap then the latter takes precedence.
What is the problem this feature would solve?
Let's say you're developing a browser app. It has two entry points -
index.js
andworker.js
- both of which import many modules so you useBun.build
to bundle them.But then there are some modules that you don't want to bundle - you want them to remain external - so you add them to the
external
array.And then in production you use an import map to resolve these external modules.
But because your browser app has a (module) worker, there's an issue - import maps are not available in workers.
So this is where this proposal comes in.
What is the feature you are proposing to solve the problem?
An
importmap
option that accepts import map object through which the bundler would map and rewrite module specifiers.It would act like the currently existing
external
option but with the added capability to rewrite module specifiers.If the same module specifier is provided both in
external
andimportmap
then the latter takes precedence.Example usage:
What alternatives have you considered?
Use Rollup with rollup-plugin-import-map.
The text was updated successfully, but these errors were encountered: