SHOW:
|
|
- or go back to the newest paste.
1 | var path = require('path') | |
2 | var webpack = require('webpack') | |
3 | ||
4 | module.exports = { | |
5 | - | entry: './src/main.js', |
5 | + | entry: './src/main.js', |
6 | - | output: { |
6 | + | output: { |
7 | - | path: path.resolve(__dirname, './dist'), |
7 | + | path: path.resolve(__dirname, './dist'), |
8 | - | publicPath: '/dist/', |
8 | + | publicPath: '/dist/', |
9 | - | filename: 'build.js' |
9 | + | filename: 'build.js' |
10 | - | }, |
10 | + | |
11 | - | module: { |
11 | + | module: { |
12 | - | loaders: [ |
12 | + | rules: [ |
13 | - | { |
13 | + | |
14 | - | test: /\.scss$/, |
14 | + | test: /\.vue$/, |
15 | - | loader: "style-loader!css-loader!postcss-loader!sass" |
15 | + | loader: 'vue-loader', |
16 | options: { | |
17 | - | ], |
17 | + | loaders: {} |
18 | - | rules: [ |
18 | + | // other vue-loader options go here |
19 | - | { |
19 | + | |
20 | - | test: /\.vue$/, |
20 | + | |
21 | - | loader: 'vue-loader', |
21 | + | |
22 | - | options: { |
22 | + | test: /\.js$/, |
23 | - | loaders: { |
23 | + | loader: 'babel-loader', |
24 | - | } |
24 | + | exclude: /node_modules/ |
25 | - | // other vue-loader options go here |
25 | + | |
26 | { | |
27 | - | }, |
27 | + | test: /\.(png|jpg|gif|svg)$/, |
28 | - | { |
28 | + | loader: 'file-loader', |
29 | - | test: /\.js$/, |
29 | + | |
30 | - | loader: 'babel-loader', |
30 | + | name: '[name].[ext]?[hash]' |
31 | - | exclude: /node_modules/ |
31 | + | |
32 | - | }, |
32 | + | |
33 | - | { |
33 | + | |
34 | - | test: /\.(png|jpg|gif|svg)$/, |
34 | + | test: /\.(scss|sass)$/, |
35 | - | loader: 'file-loader', |
35 | + | use: [ |
36 | - | options: { |
36 | + | { |
37 | - | name: '[name].[ext]?[hash]' |
37 | + | loader: "style-loader" // creates style nodes from JS strings |
38 | }, | |
39 | - | }, |
39 | + | { |
40 | - | { |
40 | + | loader: "css-loader", // translates CSS into CommonJS |
41 | - | test: /\.(scss|sass)$/, |
41 | + | options: { |
42 | - | use: [ |
42 | + | minimize: true, |
43 | discardComments: { | |
44 | - | loader: "style-loader" // creates style nodes from JS strings |
44 | + | removeAll: true |
45 | } | |
46 | } | |
47 | - | loader: "css-loader", // translates CSS into CommonJS |
47 | + | }, |
48 | - | options: cssLoaderOptions |
48 | + | { |
49 | loader: "sass-loader", // compiles Sass to CSS | |
50 | options: { | |
51 | - | loader: "sass-loader", // compiles Sass to CSS |
51 | + | sourceMap: true, |
52 | sourceMapContents: true | |
53 | - | sourceMap: useSourcemaps, |
53 | + | } |
54 | - | sourceMapContents: true |
54 | + | } |
55 | ] | |
56 | } | |
57 | ] | |
58 | }, | |
59 | - | ] |
59 | + | resolve: { |
60 | - | }, |
60 | + | alias: { |
61 | - | resolve: { |
61 | + | 'vue$': 'vue/dist/vue.esm.js' |
62 | - | alias: { |
62 | + | |
63 | - | 'vue$': 'vue/dist/vue.esm.js' |
63 | + | |
64 | - | } |
64 | + | devServer: { |
65 | - | }, |
65 | + | historyApiFallback: true, |
66 | - | devServer: { |
66 | + | noInfo: true |
67 | - | historyApiFallback: true, |
67 | + | |
68 | - | noInfo: true |
68 | + | performance: { |
69 | - | }, |
69 | + | hints: false |
70 | - | performance: { |
70 | + | |
71 | - | hints: false |
71 | + | devtool: '#eval-source-map' |
72 | - | }, |
72 | + | |
73 | - | devtool: '#eval-source-map' |
73 | + | |
74 | if (process.env.NODE_ENV === 'production') { | |
75 | module.exports.devtool = '#source-map' | |
76 | // http://vue-loader.vuejs.org/en/workflow/production.html | |
77 | - | module.exports.devtool = '#source-map' |
77 | + | module.exports.plugins = (module.exports.plugins || []).concat([ |
78 | - | // http://vue-loader.vuejs.org/en/workflow/production.html |
78 | + | new webpack.DefinePlugin({ |
79 | - | module.exports.plugins = (module.exports.plugins || []).concat([ |
79 | + | 'process.env': { |
80 | - | new webpack.DefinePlugin({ |
80 | + | NODE_ENV: '"production"' |
81 | - | 'process.env': { |
81 | + | |
82 | - | NODE_ENV: '"production"' |
82 | + | }), |
83 | - | } |
83 | + | new webpack.optimize.UglifyJsPlugin({ |
84 | - | }), |
84 | + | sourceMap: true, |
85 | - | new webpack.optimize.UglifyJsPlugin({ |
85 | + | compress: { |
86 | - | sourceMap: true, |
86 | + | warnings: false |
87 | - | compress: { |
87 | + | |
88 | - | warnings: false |
88 | + | }), |
89 | - | } |
89 | + | new webpack.LoaderOptionsPlugin({ |
90 | - | }), |
90 | + | minimize: true |
91 | - | new webpack.LoaderOptionsPlugin({ |
91 | + | }) |
92 | - | minimize: true |
92 | + | ]) |
93 | - | }) |
93 | + |