-
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
Plugins don't seem to apply to entrypoints #546
Comments
I just looked into doing this. This is potentially a breaking change for these reasons:
I'm not quite sure what to do about the last part. Some options:
|
Thanks for looking into this. One simple solution could be to add an option, defaulting to true, to insert "./" for all entry point paths. Alternatively, option 3 seems like it would be reasonable, and could be documented so as to avoid confusion. |
@evanw have you considered the following other options:
|
I have to admit I was a bit surprised to learn that A couple thoughts:
If I'm already using a JS file to configure and run esbuild, it hardly seems like much burden to specify
I think it's somewhat expected that comparing non-absolute paths will be inherently brittle. And certainly third-party plugins can't make assumptions regarding the Going back to the prior point, it seems like esbuild could safely insert |
A cheeky way to get around this right now (via API) is to map the contents of // src/entry.js
import('/path/to/item1.js');
import('/path/to/item2.js');
import('/path/to/item3.js'); esbuild.build({
entryPoints: ['src/entry.js'],
// ...
}); Now all original entries ( for (let file in metafile.outputs) {
if ('src/entry.js' in metafile.outputs[file].inputs) {
fs.unlink(file);
}
} |
Thanks for the idea @lukeed that does allow me to unblock some ideas. What I feel is still missing is that this approach precludes real code-splitting. I'm sure we'll get there pretty soon! Unfortunately, I'm a total golang noob so my effort to introduce a sort of |
That's a good point. This is currently not possible, although it may be possible in the future. There are some ideas for doing this here: #111 (comment).
This is interesting. I think it should work in the vast majority of cases, and it's very simple. It wouldn't let you transparently do things like |
I really need this for the project I am working on: https://github.com/remorses/vite-esbuild-optimizer I need to bundle node_modules entries and it's impossible to resolve the entrpoints when using Yarn PnP because these should pass trough the I hope this will land soon 🙏 |
I'm going to land this as a non-breaking change to avoid waiting longer. The |
This has been fixed in version 0.8.21. |
I thought I could use a plugin that would map entry points to an auto-generated javascript source containing a list of import statements, as a way to bundle multiple "entry" source files into a single bundle.
However, the plugin was never called on the entrypoint paths.
The text was updated successfully, but these errors were encountered: