-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathwebpack.config.js
48 lines (47 loc) · 1.35 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
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { VueLoaderPlugin } = require('vue-loader');
const config = {
//配置的entry单入口webpack4默认 ./src/index.js
// webpack打包输出配置
output:{
path:path.join(__dirname,'./dist'),
publicPath:'/dist/',
filename:'main.js'
},
module:{
rules:[
{
test:/\.vue$/,
loader:'vue-loader',
options:{
loaders:{
css:[
'vue-style-loader',
'mini-css-extract-plugin',
'css-loader'
]
}
}
},
{
test: /\.css$/,
//数组形式的话,编译是从后往前。
use:[
MiniCssExtractPlugin.loader,
'css-loader'
]
},
{
test:/\.(gif|jpg|png|woff|svg|eot|ttf)\??.*$/,
//文件小于1k就以base64形式加载
loader:'url-loader?limit=1024'
}
]
},
plugins:[
new MiniCssExtractPlugin('main.css'),
new VueLoaderPlugin()
]
};
module.exports = config;