-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
55 lines (51 loc) · 1.39 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
'use strict';
const path = require('path');
const htmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
//入口
entry: {
main: './src/main.js'
},
output: {
//所有产出资源路径
path: path.join(__dirname, 'dist'),
filename: 'build.js'
},
module: {
loaders: [{
test: /\.css$/,
loader: 'style-loader!css-loader!autoprefixer-loader'
},
{
test: /\.less$/,
loader: 'style-loader!css-loader!autoprefixer-loader!less-loader'
},
{
test: /\.(jpg|png|svg|ttf|woff|woff2|gif)$/,
loader: 'url-loader',
options: {
limit: 4096, //4096字节以上生成文件,否则base6
name: '[name].[ext]'
}
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
options: {
presets: ['es2015'], //关键字
plugins: ['transform-runtime'], //函数
}
},
{
test: /\.vue$/,
loader: 'vue-loader'
}
]
},
plugins: [
new htmlWebpackPlugin({
template: './src/index.html'
})
]
}