survivejs / webpack-book

From apprentice to master (CC BY-NC-ND)
https://survivejs.com/webpack/
2.42k stars 319 forks source link

Check webpack issue tracker for extra info #6

Closed bebraw closed 8 years ago

bebraw commented 9 years ago

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?

christianalfoni commented 9 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

christianalfoni commented 9 years ago

Btw, I found this in the documentation

Production shortcut -p Equals to --optimize-minimize --optimize-occurence-order

Maybe this is done automatically?

bebraw commented 9 years ago

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):

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.

christianalfoni commented 9 years ago

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?

bebraw commented 9 years ago

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.

christianalfoni commented 9 years ago

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 .