-
Notifications
You must be signed in to change notification settings - Fork 2.1k
webpack 4 upgrade #293
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
base: master
Are you sure you want to change the base?
webpack 4 upgrade #293
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,26 +19,31 @@ const config = merge(base, { | |
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the default There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks, you right |
||
'process.env.VUE_ENV': '"client"' | ||
}), | ||
// extract vendor chunks for better caching | ||
new webpack.optimize.CommonsChunkPlugin({ | ||
name: 'vendor', | ||
minChunks: function (module) { | ||
// a module is extracted into the vendor chunk if... | ||
return ( | ||
// it's inside node_modules | ||
/node_modules/.test(module.context) && | ||
// and not a CSS file (due to extract-text-webpack-plugin limitation) | ||
!/\.css$/.test(module.request) | ||
) | ||
} | ||
}), | ||
// extract webpack runtime & manifest to avoid vendor chunk hash changing | ||
// on every build. | ||
new webpack.optimize.CommonsChunkPlugin({ | ||
name: 'manifest' | ||
}), | ||
|
||
new VueSSRClientPlugin() | ||
] | ||
], | ||
optimization:{ | ||
runtimeChunk: { | ||
name: "manifest" | ||
}, | ||
// extract webpack runtime & manifest to avoid vendor chunk hash changing | ||
// on every build. | ||
// extract vendor chunks for better caching | ||
splitChunks:{ | ||
chunks:"initial", | ||
cacheGroups: { | ||
vendors: function (module) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried your code using webpack 4.23.1 and it fails with a "TypeError: cacheGroup.getName is not a function"
|
||
// a module is extracted into the vendor chunk if... | ||
return ( | ||
// it's inside node_modules | ||
/node_modules/.test(module.context) && | ||
// and not a CSS file (due to extract-text-webpack-plugin limitation) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I wondering if |
||
!/\.css$/.test(module.request) | ||
) | ||
} | ||
} | ||
} | ||
}, | ||
}) | ||
|
||
if (process.env.NODE_ENV === 'production') { | ||
|
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.
Why change it?
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.
"extract-text-webpack-plugin" get error : TypeError: Cannot read property 'call' of undefined
Fixing it, by adding allChunks: true
webpack/webpack#959
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.
@RezaHaidari I can't see any issues with existing ExtractTextPlugin config. Also following config isn't needed as well I guess as by setting mode to production it minifies the code anyway.
Any comments?
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.
b4b2e33