-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcraco.config.js
43 lines (41 loc) · 1.01 KB
/
craco.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
const dotenv = require("dotenv");
const { DefinePlugin } = require("webpack");
dotenv.config();
const AutoUploadPlugin = require('./AutoUploadPlugin');
const dev = process.argv.includes("--dev");
const pluginAdd = [
new DefinePlugin({
"process.env.BASE_URL": dev ? JSON.stringify("/koa") : JSON.stringify(`http://${process.env.API_SERVER_HOST}:${process.env.API_SERVER_PORT}`),
}),
]
if (!dev) {
pluginAdd.push(new AutoUploadPlugin({
remotePath: "./koa-server/static",
host: "39.96.212.224",
username: "root",
password: "nydus,1234",
}));
}
module.exports = {
devServer: {
port: 3000,
host: 'localhost',
proxy: {
"/koa": {
target: 'http://localhost:8000',
pathRewrite: { "^/koa": '' },
secure: false,
changeOrigin: true,
},
}
},
webpack: {
plugins: {
add: pluginAdd,
},
configure: (config) => {
const ignoreWarnings = [/Failed to parse source map/];
return {...config, ignoreWarnings};
},
},
}