2022-09-27 17:59:05 +08:00
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
webpack: function (config, env) {
|
2022-10-19 12:35:09 +08:00
|
|
|
if (env === 'production') {
|
|
|
|
config.output.publicPath = process.env.REACT_APP_PUBLIC_PATH;
|
2022-09-27 17:59:05 +08:00
|
|
|
}
|
|
|
|
config.resolve.alias = {
|
|
|
|
...config.resolve.alias,
|
|
|
|
'@': path.resolve(__dirname, 'src'),
|
|
|
|
'@answer/pages': path.resolve(__dirname, 'src/pages'),
|
|
|
|
'@answer/components': path.resolve(__dirname, 'src/components'),
|
|
|
|
'@answer/stores': path.resolve(__dirname, 'src/stores'),
|
|
|
|
'@answer/hooks': path.resolve(__dirname, 'src/hooks'),
|
|
|
|
'@answer/utils': path.resolve(__dirname, 'src/utils'),
|
|
|
|
'@answer/common': path.resolve(__dirname, 'src/common'),
|
2022-09-28 18:25:30 +08:00
|
|
|
'@answer/api': path.resolve(__dirname, 'src/services/api'),
|
2022-09-27 17:59:05 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
return config;
|
|
|
|
},
|
|
|
|
|
|
|
|
devServer: function (configFunction) {
|
|
|
|
return function (proxy, allowedHost) {
|
|
|
|
const config = configFunction(proxy, allowedHost);
|
|
|
|
config.proxy = {
|
|
|
|
'/answer': {
|
2022-10-28 20:01:00 +08:00
|
|
|
target: 'http://10.0.10.98:2060',
|
2022-09-27 17:59:05 +08:00
|
|
|
changeOrigin: true,
|
|
|
|
secure: false,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
return config;
|
|
|
|
};
|
|
|
|
},
|
|
|
|
};
|