-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
executable file
·57 lines (54 loc) · 1.58 KB
/
webpack.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
var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry: "./src/main.js",
output: {
path: "./build",
publicPath: "./build/",
filename: "build.js"
},
module: {
loaders: [
{test: /\.css$/, loader: "style!css"},
{test: /\.styl$/, loader: "style!css!stylus"},
{
test: /\.js$/,
loader: 'babel',
exclude: /(node_modules|bower_components)/,
query: {
presets: ['es2015']
},
plugins: ['transform-runtime']
},
{test: /\.html$/, loader: "html"},
{test: /\.vue$/, loader: 'vue'},
{test: /.(png)|(jpg)$/, loader: 'url?limit=50000'}
]
},
babel: {
presets: ['es2015', 'stage-0'],
//plugins: ['transform-runtime']
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.js'
},
extensions: ['', '.js', '.json', '.vue']
},
plugins: [
//提取文件的公共部分
new webpack.optimize.CommonsChunkPlugin('commons', 'common.js'),
new webpack.DefinePlugin({
'process.env': { //development production
NODE_ENV: '"development"'
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
],
devtool: "source-map",
contentBase: '/'
}