Closed bebraw closed 8 years ago
Yeah, that looks like a common pitfall! Related to that specific question we should have a caching section talking about hashes and that Occurrence plugin. Do you have any experience using hashes? I have only theoretical knowledge on this
Btw, I found this in the documentation
Production shortcut -p Equals to --optimize-minimize --optimize-occurence-order
Maybe this is done automatically?
This is something that is worth researching. We could show a variety of cases and then benchmark. Here are some basic scenarios I can think of (production builds):
dist.min.js
and vendor.min.js
(hash included to both, generated based on content)dist.min.js
, vendor.min.js
and load certain popular dependencies (ie. React, jQuery and such) from a CDN with a local fallback.It is important to generate hash based on file content instead of using git commit hash. This way you can leverage client caching most efficiently. vendor.min.js
is likely to receive less updates than dist.min.js
so it will more likely be available in client cache already.
In case of React and Webpack you can take things one step further with partial bundling (covered in Pete Hunt's material). The benefit of this is that initial loading of a page takes less time. You will load the needed dependencies per page as needed. It would be a good idea to show how to achieve this.
There is some research to do (ie. how to achieve these cases) but I think that would be worthwhile as this sort of knowledge is hard to come by while being extremely valuable in production environment.
Yeah, that is a great idea!
I have a section already on "lazy loading" that refers to the partial bundling thingy :-) Though missing content at the moment, getting to it soon.
Maybe we could have like a "deployment strategies" or something?
Maybe we could have like a "deployment strategies" or something?
Yeah. It feels like an entire section. You could merge that lazy loading part to it.
Yeah, good point! Lets create a section for it :-)
On Wed, Feb 11, 2015 at 8:26 AM, Juho Vepsäläinen notifications@github.com wrote:
Maybe we could have like a "deployment strategies" or something?
Yeah. It feels like an entire section. You could merge that lazy loading part to it.
— Reply to this email directly or view it on GitHub https://github.com/christianalfoni/react-webpack-cookbook/issues/6#issuecomment-73842565 .
There seems to be tons of info below question tag. Example: https://github.com/webpack/webpack/issues/739 (reproducible builds). Maybe some of that could be incorporated into the book?