-
Notifications
You must be signed in to change notification settings - Fork 0
/
config-overrides.js
54 lines (52 loc) · 1.6 KB
/
config-overrides.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
const { override, fixBabelImports, overrideDevServer, disableEsLint } = require("customize-cra");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
// https://github.com/arackaf/customize-cra
const configWebpackPlugins = () => config => {
// 太卡关闭一些插件
// 关闭`ESLINT`的插件 在`VSCode`校验
// 关闭`CaseSensitivePathsPlugin`插件
// 关闭`IgnorePlugin`插件
config.plugins = config.plugins.filter(
plugin =>
plugin.constructor.name !== "ESLintWebpackPlugin" &&
plugin.constructor.name !== "CaseSensitivePathsPlugin" &&
plugin.constructor.name !== "IgnorePlugin"
);
// 添加插件
process.env.NODE_ENV === "production" &&
config.plugins.push(
new UglifyJsPlugin({
uglifyOptions: {
compress: {
drop_debugger: true,
drop_console: true,
},
},
})
);
return config;
};
module.exports = {
webpack: override(
fixBabelImports("import", {
libraryName: "antd",
libraryDirectory: "es",
style: "css",
}),
disableEsLint(),
configWebpackPlugins()
),
devServer: overrideDevServer(config => ({
...config,
proxy: {
"/api": {
target: "http://dev.shstplus.touchczy.top/",
changeOrigin: true,
secure: false,
pathRewrite: {
"^/api": "",
},
},
},
})),
};