forked from Amanda111/Xueer_Moblie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.build.config.js
executable file
·70 lines (70 loc) · 2.03 KB
/
webpack.build.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
const webpack = require('webpack');
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const autoprefixer = require('autoprefixer');
const Dashboard = require('webpack-dashboard');
const DashboardPlugin = require('webpack-dashboard/plugin');
const postcss = require('postcss');
const dashboard = new Dashboard();
const px2rem = require('postcss-px2rem');
const csso = require('postcss-csso');
module.exports = {
entry: ['whatwg-fetch', path.resolve(__dirname, './src/main.js')],
output: {
path: path.join(__dirname, '/static'),
publicPath: '/static/',
filename: 'bundle.js'
},
module: {
loaders: [{
test: /\.vue$/,
loader: 'vue'
}, {
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/
}, {
test: /\.scss$/,
loader: "style-loader!css-loader!postcss-loader!sass-loader"
}, {
test: /\.(html|tpl)$/,
loader: 'html-loader'
}, {
test: /\.(png|jpg|gif|svg)$/,
loader: 'file?limit=8192',
query: {
name: '[name].[ext]?[hash]'
}
}]
},
vue: {
loaders: {
sass: ExtractTextPlugin.extract('vue-style-loader', 'css-loader!postcss-loader!sass-loader'),
},
postcss: function() {
let arr = [
px2rem({
remUnit: 36
}),
autoprefixer({
browsers: ['last 4 versions']
}),
csso({
restructure: false
})
];
return arr;
}
},
resolve: {
extensions: ['', '.js', '.scss', '.vue'],
},
plugins: [
new ExtractTextPlugin('style.css', {
allChunks: true,
}),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.NoErrorsPlugin(),
new DashboardPlugin(dashboard.setData)
]
};