-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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] Webpack 4 upgrade #1562
[Feature] Webpack 4 upgrade #1562
Conversation
How about side-effects of static render -- anything need to change here? |
Shouldn’t be any different that before, so not affected. |
There is still a
|
Can you describe really quickly what is broken? |
@langpavel sorry I thought the |
@rodeyseijkens Yeah, this should be done some way better 😬 I was surprised by this too 🙂 |
@langpavel new package.json script maybe? |
Latest commit removed I also pinned down the latest So what will be our status on this with this current PR? |
Unfortunately this is the reality for a lot of webpack plugins right now, extract text plugin is keeping me from upgrading on a lot of projects. Maybe there is an alternative that is v4 friendly such as https://github.com/webdeveric/webpack-assets-manifest |
- Updated packages
I implemented the webpack-assets-manifest as suggested by @tim-soft So everything is now up to date for Webpack 4.0, so in my optinion it would be ready for merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
route.chunks
dropped?
src/server.js
Outdated
...Object.keys(assets) | ||
.filter(asset => asset.includes(route.chunk)) | ||
.map(chunk => assets[chunk].js), | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rodeyseijkens Why did you remove support for route.chunks
?
May be wi can support both, chunk
and chunks
to keep this backward compatible?
@langpavel the reason is that Webpack is now intelligent enough to split everything up in chunks that overlap thus you don't need to manually configure / figure out what chunks you want to combine. That is also why the 'eager' feature was dropped cause now it is exactly serving what is needed for that page and thus not any overloading of duplicate chunk data. If we are going to manually put in more chunks it won't work because Webpack itself now figures out what chunks overlap and needs to be separate. So for example you have a Hope this clears it up.
|
Good catch! Is there a benefit to maintaining separate client and vendor bundles? edit: |
@tim-soft Well kind of right I guess, maybe we don't need to have a special configuration then for Webpack splitChunks. |
I think you are wrong (you may be right but you should proof to me 🙂) It is possible to have nested routes. |
Merged 🎉 |
* Updated for webpack 4 * Updated start.js with webpack 4 hooks API * Removed NoEmitOnErrorsPlugin and NamedModulesPlugin * Updated Layout.test to have mocked pathname in context * Removed "assets-webpack-plugin" in favour of "webpack-assets-manifest" * Changed `vendor.js` → `vendors.js` — naming consistency with webpack * `assets.json` → `asset-manifest.json` * new file `chunk-manifest.json` for SSR support Closes kriasoft#1562, kriasoft#1549
Home chunk is now handled by webpack and it generates the best chunks together.
Each route has it own chunk now instead of the
webpackMode: 'eager'
.Webpack for example creates a "home~about" and a "privacy~login" chunk and the
server.js
pushes the corresponding chunks to the SSRHtml.js
depending on the route it has.This also eliminates the need for an array in the
route.chunks
, so this is renamed toroute.chunk
and a string now.About the WIP part
There is still work that need needs to be done for the upcoming "DeprecationWarning: Tapable.plugin is deprecated. Use new API on
.hooks
instead". So in thestart.js
we use thecompiler.plugin('compile')
for example these still need to be changed to the new API.If any of you have questions/enhancements please leave a comment
#1549