11var path = require ( 'path' )
22var config = require ( '../config' )
33var utils = require ( './utils' )
4- var webpack = require ( 'webpack' )
5- var merge = require ( 'webpack-merge' )
6- var baseWebpackConfig = require ( './webpack.base.conf' )
7- var ExtractTextPlugin = require ( 'extract-text-webpack-plugin' )
8- var HtmlWebpackPlugin = require ( 'html-webpack-plugin' )
4+ const webpack = require ( 'webpack' )
5+ const { merge } = require ( 'webpack-merge' )
6+ const baseWebpackConfig = require ( './webpack.base.conf' )
7+ const MiniCssExtractPlugin = require ( 'mini-css-extract-plugin' )
8+ const HtmlWebpackPlugin = require ( 'html-webpack-plugin' )
9+ const TerserPlugin = require ( 'terser-webpack-plugin' )
910
1011var env
1112if ( process . env . NODE_ENV === 'testing' ) {
@@ -18,33 +19,23 @@ console.log('webpack env :\n', env)
1819
1920var webpackConfig = merge ( baseWebpackConfig , {
2021 module : {
21- loaders : utils . styleLoaders ( { sourceMap : config . build . productionSourceMap , extract : true } )
22+ rules : utils . styleLoaders ( { sourceMap : config . build . productionSourceMap , extract : true } )
2223 } ,
23- devtool : config . build . productionSourceMap ? '# source-map' : false ,
24+ devtool : config . build . productionSourceMap ? 'source-map' : false ,
2425 output : {
2526 path : config . build . assetsRoot ,
26- filename : utils . assetsPath ( 'js/[name].[chunkhash].js' ) ,
27- chunkFilename : utils . assetsPath ( 'js/[id].[chunkhash].js' )
28- } ,
29- vue : {
30- loaders : utils . cssLoaders ( {
31- sourceMap : config . build . productionSourceMap ,
32- extract : true
33- } )
27+ filename : utils . assetsPath ( 'js/[name].[contenthash].js' ) ,
28+ chunkFilename : utils . assetsPath ( 'js/[id].[contenthash].js' )
3429 } ,
3530 plugins : [
3631 // http://vuejs.github.io/vue-loader/workflow/production.html
3732 new webpack . DefinePlugin ( {
3833 'process.env' : env
3934 } ) ,
40- new webpack . optimize . UglifyJsPlugin ( {
41- compress : {
42- warnings : false
43- }
44- } ) ,
45- new webpack . optimize . OccurenceOrderPlugin ( ) ,
4635 // extract css into its own file
47- new ExtractTextPlugin ( utils . assetsPath ( 'css/[name].[contenthash].css' ) ) ,
36+ new MiniCssExtractPlugin ( {
37+ filename : utils . assetsPath ( 'css/[name].[contenthash].css' )
38+ } ) ,
4839 // generate dist index.html with correct asset hash for caching.
4940 // you can customize output by editing /index.html
5041 // see https://github.com/ampedandwired/html-webpack-plugin
0 commit comments