forked from LANIF-UI/dva-boot-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig-overrides.js
34 lines (29 loc) · 939 Bytes
/
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
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-admin/'; // 跟据实际项目设置
}
config = injectBabelPlugin('transform-decorators-legacy', config);
config = injectBabelPlugin(
['import', { libraryName: 'antd', style: true }],
config
);
config.externals = {};
return rewireLess.withLoaderOptions(
`${env === 'production' ? 'app' : '[local]'}-[hash:base64:8]`,
{
modifyVars: {}
}
)(config, env);
};