answer/ui/config-overrides.js

50 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-09-27 17:59:05 +08:00
const path = require('path');
const i18nLocaleTool = require('./scripts/i18n-locale-tool');
2022-09-27 17:59:05 +08:00
module.exports = {
webpack: function (config, env) {
if (env === 'production') {
config.output.publicPath = process.env.REACT_APP_PUBLIC_PATH;
i18nLocaleTool.resolvePresetLocales();
2022-09-27 17:59:05 +08:00
}
for (let _rule of config.module.rules) {
if (_rule.oneOf) {
_rule.oneOf.unshift({
test: /\.ya?ml$/,
use: 'yaml-loader'
});
break;
}
}
2022-09-27 17:59:05 +08:00
config.resolve.alias = {
...config.resolve.alias,
'@': path.resolve(__dirname, 'src'),
};
return config;
},
devServer: function (configFunction) {
i18nLocaleTool.autoSync();
2022-09-27 17:59:05 +08:00
return function (proxy, allowedHost) {
const config = configFunction(proxy, allowedHost);
config.proxy = {
'/answer': {
target: 'http://10.0.10.98:2060',
2022-11-03 17:44:59 +08:00
changeOrigin: true,
secure: false,
},
'/installation': {
target: 'http://10.0.10.98:2060',
2022-09-27 17:59:05 +08:00
changeOrigin: true,
secure: false,
},
};
return config;
};
},
};