Fix chunks ordering in case of manifest + vendor files#115
Conversation
… commonschunkplugin
|
There seems to have been an issue with the Node version used by Travis for its testing. I’ve updated it to Node 6 (LTS Boron). |
|
There’s probably an issue with the generated GZIP (looks like even if the source HTML / gunzip’d HTML are the exact same, some bits are different in the GZIP itself). For reference I’m on macOS 10.12.6 and using compression-webpack-plugin version 1.0.0. Imho it’s not safe to diff the Edit: reverted the |
|
Hi all, thanks for your amazing work! you can merge this pull request? Thanks!! |
|
Great work @izeau, any idea when this is going to merge? |
|
Hey @rafa-aguilar and @AlasdairSwan, unfortunately I’m not an owner of this repository and therefore cannot merge this PR. Meanwhile, feel free to use my fork. |
|
@markdalgleish Anyone home? |
|
This PR I believe is not needed. The correct CommonsChunkPlugin configuration is needed. This is what works for me: const plugins = [
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
chunks: ['vendor', 'webApp'],
minChunks: (module) => {
return module.context && module.context.includes('node_modules');
},
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest',
chunks: ['vendor', 'webApp'],
minChunks: Infinity,
}),
new StaticSiteGeneratorPlugin({
entry: 'prerenderedApp',
paths: [
'/',
'/about',
'/faq',
'/terms',
'/login',
'/privacy',
],
locals: {
ejs, // Pass in templating engine to static.js
clientPath: config.paths.client(),
contentSecurityPolicy,
},
globals: {
window: {
navigator: {},
matchMedia: () => ({}),
addEventListener: () => {
},
analytics: {
page: () => {
},
},
},
},
}),
];This configuration lets me build chunked Thus, both static and dynamic apps are generated in one compilation. |
|
Would you be interested in software that automatically finds ReferenceErrors and TypeErrors, caused by corner cases like these? I am building Fuzz Stati0n to do that (free for OSS) - please take a look and consider signing up for our newsletter to keep in touch. |
|
Pretty sure your advertisement has nothing to do with this PR. |
|
@heisian nice one! I can’t test it right now but I’ll give it a look. It’s been a while, I don’t really remember the configuration I used. Thanks! |
|
@izeau I spent a few days using your PR at first, but I was still getting BTW i have multiple entrypoints in my webpack config: |
Based on work done by @HorizonXP in #84 & @stephen-haddix in #64
ERROR in ReferenceError: webpackJsonp is not definedERROR in TypeError: Cannot read property 'call' of undefinedCoverage 100%, all tests passing.