|
1 |
| -var path = require('path') |
2 |
| -var webpack = require('webpack') |
| 1 | +const path = require('path') |
| 2 | +const webpack = require('webpack') |
| 3 | +const VueLoaderPlugin = require('vue-loader/lib/plugin') |
3 | 4 |
|
4 | 5 | module.exports = {
|
| 6 | + mode: 'development', |
5 | 7 | entry: './src/main.js',
|
6 | 8 | output: {
|
7 | 9 | path: path.resolve(__dirname, '../docs'),
|
8 | 10 | publicPath: '/',
|
9 |
| - filename: 'build.js' |
| 11 | + filename: 'build.js', |
10 | 12 | },
|
11 | 13 | module: {
|
12 | 14 | rules: [
|
13 | 15 | {
|
14 | 16 | test: /\.vue$/,
|
15 | 17 | loader: 'vue-loader',
|
16 |
| - options: { |
17 |
| - loaders: { |
18 |
| - // Since sass-loader (weirdly) has SCSS as its default parse mode, we map |
19 |
| - // the "scss" and "sass" values for the lang attribute to the right configs here. |
20 |
| - // other preprocessors should work out of the box, no loader config like this nessessary. |
21 |
| - 'scss': 'vue-style-loader!css-loader!sass-loader', |
22 |
| - 'sass': 'vue-style-loader!css-loader!sass-loader?indentedSyntax' |
23 |
| - } |
24 |
| - // other vue-loader options go here |
25 |
| - } |
26 | 18 | },
|
27 | 19 | {
|
28 | 20 | test: /\.js$/,
|
29 | 21 | loader: 'babel-loader',
|
30 |
| - exclude: /node_modules/ |
| 22 | + exclude: /node_modules/, |
31 | 23 | },
|
32 | 24 | {
|
33 | 25 | test: /\.(png|jpg|gif|svg)$/,
|
34 | 26 | loader: 'file-loader',
|
35 | 27 | options: {
|
36 |
| - name: '[name].[ext]?[hash]' |
37 |
| - } |
| 28 | + name: '[name].[ext]?[hash]', |
| 29 | + }, |
38 | 30 | },
|
39 | 31 | {
|
40 | 32 | test: /\.css$/,
|
41 |
| - loader: 'style-loader!css-loader' |
42 |
| - } |
43 |
| - ] |
| 33 | + use: [ |
| 34 | + 'vue-style-loader', |
| 35 | + 'css-loader', |
| 36 | + { |
| 37 | + loader: 'postcss-loader', |
| 38 | + options: { |
| 39 | + config: { |
| 40 | + path: path.resolve(__dirname, '.postcssrc.js'), |
| 41 | + }, |
| 42 | + }, |
| 43 | + }, |
| 44 | + ], |
| 45 | + }, |
| 46 | + ], |
44 | 47 | },
|
45 | 48 | resolve: {
|
46 | 49 | alias: {
|
47 |
| - 'vue$': 'vue/dist/vue.common.js' |
48 |
| - } |
| 50 | + 'vue$': 'vue/dist/vue.common.js', |
| 51 | + }, |
49 | 52 | },
|
| 53 | + plugins: [ |
| 54 | + new VueLoaderPlugin(), |
| 55 | + ], |
50 | 56 | devServer: {
|
51 | 57 | historyApiFallback: true,
|
52 | 58 | noInfo: true,
|
53 |
| - contentBase: path.join(__dirname, "..", "docs"), |
| 59 | + contentBase: path.join(__dirname, '..', 'docs'), |
54 | 60 | },
|
55 | 61 | performance: {
|
56 |
| - hints: false |
| 62 | + hints: false, |
57 | 63 | },
|
58 |
| - devtool: '#eval-source-map' |
| 64 | + devtool: '#eval-source-map', |
59 | 65 | }
|
60 | 66 |
|
61 | 67 | if (process.env.NODE_ENV === 'production') {
|
| 68 | + module.exports.mode = 'production' |
62 | 69 | module.exports.devtool = '#source-map'
|
63 | 70 | // http://vue-loader.vuejs.org/en/workflow/production.html
|
64 | 71 | module.exports.plugins = (module.exports.plugins || []).concat([
|
65 | 72 | new webpack.DefinePlugin({
|
66 | 73 | 'process.env': {
|
67 |
| - NODE_ENV: '"production"' |
68 |
| - } |
69 |
| - }), |
70 |
| - new webpack.optimize.UglifyJsPlugin({ |
71 |
| - sourceMap: true, |
72 |
| - compress: { |
73 |
| - warnings: false |
74 |
| - } |
| 74 | + NODE_ENV: '"production"', |
| 75 | + }, |
75 | 76 | }),
|
76 |
| - new webpack.LoaderOptionsPlugin({ |
77 |
| - minimize: true |
78 |
| - }) |
79 | 77 | ])
|
80 | 78 | }
|
0 commit comments