forked from yoursistersoul/nft-painting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.js
75 lines (73 loc) · 1.67 KB
/
webpack.dev.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
const path = require('path');
const resolve = dir => path.resolve(__dirname, dir);
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './app/main.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'main.js'
},
mode: 'development',
plugins: [
new VueLoaderPlugin(),
new HtmlWebpackPlugin({
template: 'app/index.html',
})
],
resolve: {
// 设置别名
alias: {
'@': resolve('app/src'),
'@view': resolve('app/views'),
'@style': resolve('app/style'),
'@img': resolve('app/images')
}
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader' // 处理以.vue结尾的文件
},
{
test: /\.css$/, // 处理css文件
use: [
'vue-style-loader',
'style-loader',
'css-loader'
]
},
{
test: /\.(gif|jpg|jpeg|png|svg)$/, // 处理图片文件
use: [
{
loader: 'url-loader',
options: {
limit: 0,
name: '[name].[ext]'
}
}
]
},
{
test: /\.(eot|svg|ttf|woff|woff2)(\?\S*)?$/,
loader: 'file-loader'
},
{
test: /\.scss$/,
use: [
{
loader: "file-loader"
},
{
loader: "style-loader" // 将 JS 字符串生成为 style 节点
}, {
loader: "css-loader" // 将 CSS 转化成 CommonJS 模块
}, {
loader: "sass-loader" // 将 Sass 编译成 CSS
}]
}
]
}
};