-
Notifications
You must be signed in to change notification settings - Fork 4
/
config-overrides.js
39 lines (32 loc) · 1.05 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
const path = require("path");
const { injectBabelPlugin } = require("react-app-rewired");
const rewireLess = require("react-app-rewire-less-modules");
module.exports = function override(config, env) {
config.resolve = {
alias: {
"@": path.resolve(__dirname, "src"),
components: path.resolve(__dirname, "src/components"),
assets: path.resolve(__dirname, "src/assets")
}
};
if (env === "development") {
config = injectBabelPlugin(["dva-hmr"], config);
} else {
config.output.publicPath = "/dva-boot-mobile/"; // 实际跟据项目设置
}
config = injectBabelPlugin("transform-decorators-legacy", config);
// 如果用了antd的话可以配置按需加载
config = injectBabelPlugin(
["import", { libraryName: "antd-mobile", style: "css" }],
config
);
config.externals = {};
config.plugins.push();
// 如果用了antd的话可以修改皮肤
return rewireLess.withLoaderOptions(
`${env === "production" ? "app" : "[local]"}-[hash:base64:8]`,
{
modifyVars: {}
}
)(config, env);
};