-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathwebpack.config.js
executable file
·43 lines (42 loc) · 1.14 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
var path = require('path');
var webpack = require('webpack');
module.exports = {
// 入口
entry: './src/index',
// 输出
output: {
path: path.join(__dirname, './dist'),
filename: '[name].js',
publicPath: '/dist/'
},
module: {
// 加载器
loaders: [
{ test: /\.vue$/, loader: 'vue' },
{ test: /\.js$/, loader: 'babel', exclude: /node_modules/ },
{ test: /\.css$/, loader: 'style!css!autoprefixer' },
{ test: /\.less/, loader: 'style!css!autoprefixer!less' },
{ test: /\.(png|jpg|gif)$/, loader: 'url-loader' },
{ test: /\.(html|tpl)$/, loader: 'html-loader' },
]
},
vue: {
loaders: {
css: 'style!css!autoprefixer!less'
}
},
babel: {
presets: ['es2015'],
plugins: ['transform-runtime']
},
resolve: {
// require时省略的扩展名,如:require('module') 不需要module.js
extensions: ['', '.js', '.vue'],
},
// 开启source-map,webpack有多种source-map,在官网文档可以查到
devtool: '#source-map',
plugins: [
new webpack.optimize.CommonsChunkPlugin('common.js'),
new webpack.optimize.OccurenceOrderPlugin(),
]
};