-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Call all plugins onResolve instead of using only the first one #501
Comments
I'd be worried about performance implications One way to deal with that is by default plugins don't allow other plugins. In the object the plugin returns, the plugin could do something like: // ... plugin code
return { contents: code, runOtherPlugins: true}
// ... rest of plugin code And then, if the plugin doesn't set build({
// ...esbuild config
plugins: [
[plugin, {runOtherPlugins: true}]
],
}) This assumes you usually don't want plugins to run other plugins, which is probably the case for every file type except JavaScript/TypeScript |
@Jarred-Sumner i think there would be no performance degradation, a plugin can early return a |
I met the exact same needs as you, @remorses . But your PR only modifies the TS part for esbuild. I believe there is another GO part: https://github.com/evanw/esbuild/blob/master/internal/bundler/bundler.go#L587-L640. And I would argue that the api of EDIT: Actually, I can write a middleware-like plugin system that accepts middleware-like plugin, as a esbuild plugin, if the proposal is not acceptable. I guess that is what the author originally thought (
So better no special treat for file systems, like what the comment in #546 (comment). My point is to make entrypoint same as import paths. A simpler and consistent api would make the loop more easier to implement.
|
Currently only the first plugin onResolve result will be used, this means there is no way to override a previous plugin result
Calling all plugins allows you to override previous plugins
The text was updated successfully, but these errors were encountered: