Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
RezaHaidari wants to merge3 commits intovuejs:master
base:master
Choose a base branch
Loading
fromRezaHaidari:master
Open

Conversation

RezaHaidari
Copy link
Contributor

No description provided.

asadsahi reacted with thumbs up emojiasadsahi, jacoborus, TheJuki, eugenioclrc, and ozguruysal reacted with hooray emoji
@asadsahi
Copy link

asadsahi commentedMar 5, 2018
edited
Loading

great job@RezaHaidari works perfect for me. I have just upgraded based on your changes a project which is based on vue-hackernews.

@asadsahi
Copy link

@RezaHaidari in webpack.base.config.js you have added uglifyjsplugin with sourcemaps:

if (isProd) {  config.optimization = {    ...config.optimization,    minimizer: [      new UglifyJsPlugin({        sourceMap: true,        uglifyOptions: {          compress: {            inline: false,          },        },      }),    ],  };}

But it doesn't generate any sourcemaps, alos, how different is it compared to default optimisation webpack 4 does in --mode=production?

@sirlancelot
Copy link
Contributor

CommonsChunkPlugin is no longer needed, nor is UglifyJsPlugin. All of those options are abstracted in tooptions.optimization. They are activated depending onoptions.mode which should be set to either"development" or"production"

@asadsahi
Copy link

@sirlancelot you are right. But I was also wondering how to enable sourcemaps in production with --mode=production. First I though this pull request is achiving that with uglifyjsplugin, but there must be an lternative with defaults.

@@ -19,26 +19,31 @@ const config = merge(base, {
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

the defaultNODE_ENV is not same asmode? And it can be removed.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

thanks, you right

new webpack.optimize.ModuleConcatenationPlugin(),
new ExtractTextPlugin({
filename: 'common.[chunkhash].css'
filename: 'common.[chunkhash].css',
allChunks: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why change it?

Copy link
ContributorAuthor

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

Copy link

@asadsahiasadsahiMar 6, 2018
edited
Loading

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.

if (isProd) {  config.optimization = {    ...config.optimization,    minimizer: [      new UglifyJsPlugin({        sourceMap: true,        uglifyOptions: {          compress: {            inline: false,          },        },      }),    ],  };}

Any comments?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

package.json Outdated
@@ -4,7 +4,7 @@
"author": "Evan You <yyx990803@gmail.com>",
"private": true,
"scripts": {
"dev": "node server",
"dev": "cross-env NODE_ENV=developmentnode server",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why change it?

@asadsahiasadsahi mentioned this pull requestMar 7, 2018
splitChunks:{
chunks:"initial",
cacheGroups: {
vendors: function (module) {

Choose a reason for hiding this comment

The 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"
The correct form for cacheGroups entries seems different (seehttps://webpack.js.org/plugins/split-chunks-plugin/#splitchunks-cachegroups)

  vendors: {    test: function(module) {

return (
// it's inside node_modules
/node_modules/.test(module.context) &&
// and not a CSS file (due to extract-text-webpack-plugin limitation)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

due to extract-text-webpack-plugin limitation

I wondering ifmini-css-extract-plugin has the same limitation ?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@asadsahiasadsahiasadsahi left review comments

@JounQinJounQinJounQin left review comments

@FranckFreiburgerFranckFreiburgerFranckFreiburger left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@RezaHaidari@asadsahi@sirlancelot@JounQin@FranckFreiburger

[8]ページ先頭

©2009-2025 Movatter.jp