-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.js
42 lines (41 loc) · 922 Bytes
/
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
const webpack = require('webpack')
const path = require('path')
const { entry, baseModuleRules, basePlugins } = require('./webpack.base.js')
module.exports = {
mode: 'development',
entry,
output: {
filename: '[name].js',
path: path.join(__dirname, 'dist')
},
module: {
rules: [
...baseModuleRules,
{
test: /\.less$/,
use: ['style-loader', 'css-loader', 'less-loader']
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
}
]
},
resolve: {
// 设置别名
alias: {
'@': path.join(__dirname, 'src') // 这样配置后 @ 可以指向 src 目录
}
},
plugins: [...basePlugins, new webpack.HotModuleReplacementPlugin()],
devServer: {
contentBase: 'dist',
hot: true,
proxy: {
'/api': {
target: 'http://raydaydayup.cn:3000',
pathRewrite: { '^/api': '' }
}
}
}
}