-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Question: transform
stage in plugins.
#1902
Comments
Yes, I should do this. The general workaround right now is to have one plugin wrap the other and emulate esbuild's API but that sucks obviously. |
In addition to the plugin enhancement, I found another requirement that help to get rid of "bundle twice" -- by enforce the order. Not too many, only an |
Sorry for the bump, but is there a package that handles the manual daisy-chaining of plugins for me? edit: using esbuild-rna for now... |
I need this for a plugin I'm writing which minifies the contents of specific template strings. |
@easrng I wrote a package that might help you: https://github.com/aleclarson/esbuild-extra |
This question is about plugin composition, I used to be curious why rollup has 3 essential steps:
resolveId, load, transform
, now I have an answer: Plugins can be composited by doing different step.Say we have a svelte plugin and a virtual icons plugin, which creates virtual module in your code and you just import it and use:
If it is in rollup, the two plugins can be composited by:
Only the svelte plugin has to call svelte-compiler, so we can put compiler options (like whether to generate SSR code) in one place.
However, in esbuild plugins, we must do all works in
onLoad
, the icons plugin now has to call svelte-compiler, and we must pass compiler options to all of them.There are other ways to deal with the same problem, for example:
loader: 'svelte'
, so that itsonLoad
can receive contents from other plugins.I'm not sure which is the correct way to handle this usage.
The text was updated successfully, but these errors were encountered: