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

docs on bundles, chunks, long term caching #134

Closed
pksjce opened this issue Sep 7, 2016 · 6 comments
Closed

docs on bundles, chunks, long term caching #134

pksjce opened this issue Sep 7, 2016 · 6 comments

Comments

@pksjce
Copy link

pksjce commented Sep 7, 2016

From @greaber on June 25, 2016 17:15

I'm posting this because I think I understand something about webpack, but I'm not sure, and whether I am right or not, I think the docs could be improved.

I have been using webpack for several months, and I was hazy for a long time about the difference between chunks and bundles. As I now understand it, though, it is pretty simple. a chunk is just any output produced by webpack, and a bundle is (essentially) all the outputs produced by webpack. At any rate, the chunkhash directive, used in naming an output, expands to a hash of that output, while the bundle directive expands to a hash of all the outputs. If this understanding is right, I think it could be made more clear in the docs.

Some things that make it confusing are that "bundle" is often used to name a particular output and that the long term caching docs suggest there are two options that you might equally want, using per-chunk hashes and using per-bundle hashes, whereas, if I understand correctly, you would almost always want to use a per-chunk hash. (The only downside of that seems to be that, according to the docs, you cannot use it in conjunction with hot module replacement, but my understanding is that hot module replacement is a dev feature, and you don't need to use any of this hashing in dev because you can just use the dev server or simply disable caching.)

Another thing that is perhaps confusing about these concepts of chunks and bundles is the way the output section has options for filename and chunkFilename. If my understanding is correct, all outputs are chunks, and all chunks outputs. The filename option is just used to specify the names of entry chunks. But the docs for it say "Specifies the name of each output file on disk", so I'm not sure.

Copied from original issue: webpack/webpack#2692

@pksjce
Copy link
Author

pksjce commented Nov 8, 2016

Doesnt this file solve this issue?

@bebraw
Copy link
Contributor

bebraw commented Nov 8, 2016

Yup. Time to close.

@bebraw bebraw closed this as completed Nov 8, 2016
hzuhyb pushed a commit to hzuhyb/webpack.js.org that referenced this issue Feb 18, 2017
/content/concepts/index.md 校对
@rafaeleyng
Copy link

I came here trying to understand what a chunk is, but no help. The link @pksjce posted is broken, also

@rafaeleyng
Copy link

If it is the link to the "caching" documentation, that didn't help me to understand what a chunk is.

@skipjack
Copy link
Collaborator

@rafaeleyng #970 is definitely the issue you want. I just re-opened.

@rafaeleyng
Copy link

Ok, I asked some questions there too. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants