-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.dev.js
47 lines (44 loc) · 1.29 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
/*
* @Author: [email protected]
* @Date: 2018-09-02 20:49:25
* @Last Modified by: [email protected]
* @Last Modified time: 2018-09-04 11:21:08
*/
const path = require("path");
const WebpackMerge = require("webpack-merge");
const CommonConfig = require("./webpack.common");
const ProxyUrl = "https://easy-mock.com/mock/5b8c9f2fdcc57313cd5b6678";
module.exports = WebpackMerge(CommonConfig, {
devtool: "inline-source-map",
mode: "development",
module: {
rules: [
{
test: /\.css$/,
use: ["style-loader", "css-loader"]
},
{
test: /\.less$/,
use: ["style-loader", "css-loader", "less-loader"]
},
{
test: /\.s(a|c)ss$/,
use: ["style-loader","css-loader","sass-loader"]
}
]
},
devServer: {
contentBase: path.join(__dirname, "dist"),
historyApiFallback: true,
// 指定使用一个 host。默认是 localhost。如果你希望服务器外部可访问,写法如下
host: "0.0.0.0",
port: 9090,
proxy: {
"/api/*": {
target: ProxyUrl,
changeOrigin: true,
secure: false
}
}
}
});