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

[Feature] configurable chunks #268

Closed
Ventajou opened this issue Jul 17, 2020 · 3 comments
Closed

[Feature] configurable chunks #268

Ventajou opened this issue Jul 17, 2020 · 3 comments

Comments

@Ventajou
Copy link

Would it be possible to configure what goes into the chunks and also the file name of each chunk?

Our current Webpack build generates a separate chunk for each package in node_modules. Also the file content hash is used in every chunk name for cache busting (including the main chunk). This lets us cache our assets indefinitely and browsers don't have to download all node modules when only a couple of them have changed.

To serve something like that, we'd need to populate index.html with script tags for each chunk needed by the entry point, but maybe the API can return that?

@evanw
Copy link
Owner

evanw commented Jul 29, 2020

Would it be possible to configure what goes into the chunks and also the file name of each chunk?

There are a lot of ways people in the community have been customizing their code splitting, and I'm not sure that esbuild should support all of them. Right now I'm deliberately keeping things simple. Code splitting is still a work in progress (which is why #16 is still open) so if you have serious code splitting needs, esbuild is probably not a good fit at the moment.

This lets us cache our assets indefinitely and browsers don't have to download all node modules when only a couple of them have changed.

Chunk names do not currently include a hash of the file contents, so they are not suitable for indefinite caching in the fine-grained way you are looking for. This will be implemented by the time the code splitting feature is complete.

To serve something like that, we'd need to populate index.html with script tags for each chunk needed by the entry point, but maybe the API can return that?

This information is available in the optional JSON metadata file. You can generate it by passing the desired output path for the metadata using the metafile flag.

@intrnl
Copy link

intrnl commented Aug 12, 2020

This and #207 might be similar in terms of what it wants to achieve 🙂

@evanw
Copy link
Owner

evanw commented Oct 17, 2021

Closing this in favor of #207.

@evanw evanw closed this as completed Oct 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants