-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.config.js
53 lines (53 loc) · 1.09 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
const ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry: './main.js',
output: {
path: __dirname,
filename: 'build.js'
},
// 使用独立构建
resolve: {
alias: {
'vue$': 'vue/dist/vue.common.js'
}
},
module: {
rules: [
{
test: /\.js$/,
use: ['babel-loader'],
exclude: /node_modules/
},
{
test: /\.vue$/,
use: {
loader: 'vue-loader',
options: {
loaders: {
css: ExtractTextPlugin.extract({
use: 'css-loader'
})
}
}
}
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
use: 'css-loader'
})
}
]
},
plugins: [
new ExtractTextPlugin({
filename: '/common.css'
})
]
/*,
babel: {
presets: ['es2015'],
// vue中使用mapActions等辅助函数,需要安装transform-object-rest-spread插件,独立配置在.babelrc中
plugins: ['transform-runtime', 'transform-object-rest-spread']
}*/
}