2024-06-11 08:14:31 +00:00
|
|
|
module.exports = {
|
2024-06-13 00:50:28 +00:00
|
|
|
lintOnSave: false,
|
2024-09-13 05:22:40 +00:00
|
|
|
publicPath: './', // 设置公共路径为相对路径
|
2024-06-13 00:50:28 +00:00
|
|
|
devServer: {
|
|
|
|
|
proxy: {
|
|
|
|
|
'/api': {
|
2024-09-12 01:20:48 +00:00
|
|
|
target: 'https://local.xinsiketang.com',
|
2024-06-13 00:50:28 +00:00
|
|
|
changeOrigin: true,
|
|
|
|
|
// pathRewrite: {
|
|
|
|
|
// '^/api': '/api'
|
|
|
|
|
// },
|
|
|
|
|
logLevel: 'debug', // 用于调试时查看代理请求详情
|
|
|
|
|
onProxyRes(proxyRes, req, res) {
|
|
|
|
|
let responseBody = '';
|
|
|
|
|
proxyRes.on('data', (chunk) => {
|
|
|
|
|
responseBody += chunk;
|
|
|
|
|
});
|
|
|
|
|
proxyRes.on('end', () => {
|
2024-06-18 03:30:25 +00:00
|
|
|
// console.log('Proxy response body:', responseBody);
|
2024-06-13 00:50:28 +00:00
|
|
|
});
|
|
|
|
|
console.log('Proxy response:', res.statusCode);
|
|
|
|
|
}
|
2024-07-10 08:49:16 +00:00
|
|
|
},
|
|
|
|
|
'/remote':{
|
|
|
|
|
target : "https://smile-ebook.oss-cn-qingdao.aliyuncs.com",
|
|
|
|
|
changeOrigin : true,
|
|
|
|
|
pathRewrite: {
|
|
|
|
|
'^/remote': '/'
|
|
|
|
|
},
|
|
|
|
|
logLevel : 'debug',
|
|
|
|
|
onProxyRes(proxyRes, req, res) {
|
|
|
|
|
let responseBody = '';
|
|
|
|
|
proxyRes.on('data', (chunk) => {
|
|
|
|
|
responseBody += chunk;
|
|
|
|
|
});
|
|
|
|
|
proxyRes.on('end', () => {
|
|
|
|
|
// console.log('Proxy response body:', responseBody);
|
|
|
|
|
});
|
|
|
|
|
console.log('Proxy response:', res.statusCode);
|
|
|
|
|
}
|
2024-06-13 00:50:28 +00:00
|
|
|
}
|
2024-07-10 08:49:16 +00:00
|
|
|
|
2024-06-13 00:50:28 +00:00
|
|
|
}
|
2024-06-18 03:30:25 +00:00
|
|
|
},
|
2024-07-10 03:34:11 +00:00
|
|
|
|
|
|
|
|
configureWebpack:(config)=>{
|
2024-09-12 01:20:48 +00:00
|
|
|
// config.devtool = 'source-map';
|
2024-07-10 03:34:11 +00:00
|
|
|
// config.stats = 'errors-warings'
|
|
|
|
|
// config.plugins.push(
|
|
|
|
|
// new webpack.ProgressPlugin({
|
|
|
|
|
// handler:() => {},
|
|
|
|
|
// })
|
|
|
|
|
// )
|
2024-09-12 01:20:48 +00:00
|
|
|
},
|
|
|
|
|
chainWebpack: config => {
|
|
|
|
|
// 细粒度的 Webpack 配置修改
|
|
|
|
|
config.module
|
|
|
|
|
.rule('js')
|
|
|
|
|
.test(/\.m?jsx?$/)
|
|
|
|
|
.exclude
|
|
|
|
|
.clear() // 清除默认的 exclude 条件
|
|
|
|
|
.end()
|
|
|
|
|
.include
|
|
|
|
|
.add(/node_modules\/mind-elixir/) // 包含 mind-elixir
|
|
|
|
|
.add(/src\/plugin\/xml-digital-teaching\/lib/) // 包含本地文件夹
|
|
|
|
|
.end()
|
|
|
|
|
.use('babel-loader')
|
|
|
|
|
.loader('babel-loader')
|
|
|
|
|
.tap(options => {
|
|
|
|
|
// 如果需要,可以在此处修改 Babel 配置
|
|
|
|
|
return options;
|
|
|
|
|
});
|
|
|
|
|
config.plugin('html').tap((args) => {
|
|
|
|
|
args[0].title = 'Your Custom Title';
|
|
|
|
|
return args;
|
|
|
|
|
});
|
2024-06-13 00:50:28 +00:00
|
|
|
}
|
2024-06-11 08:14:31 +00:00
|
|
|
}
|