vuejs / vue-hackernews-2.0

HackerNews clone built with Vue 2.0, vue-router & vuex, with server-side rendering
MIT License
10.96k stars 2.15k forks source link

webpack 4 upgrade #293

Open RezaHaidari opened 6 years ago

asadsahi commented 6 years ago

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

asadsahi commented 6 years ago

@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 commented 6 years ago

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

asadsahi commented 6 years ago

@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.