2025-01-08 11:00:20 +00:00
|
|
|
|
console.log("cycccccccc")
|
|
|
|
|
|
console.log(process.env.BUILD_DIR)
|
|
|
|
|
|
console.log("cycccccccc")
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-13 02:53:59 +00:00
|
|
|
|
//
|
|
|
|
|
|
var targetServer = "https://xinsiketang.com"
|
|
|
|
|
|
|
2025-10-23 02:39:42 +00:00
|
|
|
|
console.log("hellolllllllooooo")
|
|
|
|
|
|
console.log(process.env.NODE_ENV)
|
|
|
|
|
|
// process.exit(0); // 0 表示正常退出,非0表示异常退出
|
|
|
|
|
|
|
|
|
|
|
|
var publicPath = 'https://smile-ebook-online.xinsiketang.com/reading/'
|
|
|
|
|
|
publicPath = "./"
|
|
|
|
|
|
|
|
|
|
|
|
console.log(publicPath)
|
|
|
|
|
|
// process.exit(0); // 0 表示正常退出,非0表示异常退出
|
|
|
|
|
|
|
|
|
|
|
|
console.log(process.env.NODE_ENV)
|
|
|
|
|
|
// process.exit(0);
|
|
|
|
|
|
if(process.env.NODE_ENV === 'production'){
|
2025-03-13 02:53:59 +00:00
|
|
|
|
targetServer = "https://xinsiketang.com"
|
|
|
|
|
|
}else{
|
2025-06-12 09:08:52 +00:00
|
|
|
|
targetServer = "https://dev.xinsiketang.com"
|
2025-03-13 02:53:59 +00:00
|
|
|
|
}
|
2025-06-12 09:08:52 +00:00
|
|
|
|
// targetServer = "https://xinsiketang.com"
|
2025-03-13 02:53:59 +00:00
|
|
|
|
console.log("targetServer",targetServer)
|
|
|
|
|
|
|
2025-10-23 02:39:42 +00:00
|
|
|
|
|
2024-06-11 08:14:31 +00:00
|
|
|
|
module.exports = {
|
2024-06-13 00:50:28 +00:00
|
|
|
|
lintOnSave: false,
|
2025-10-23 02:39:42 +00:00
|
|
|
|
publicPath: publicPath, // 设置公共路径为相对路径
|
|
|
|
|
|
// publicPath: "https://smile-ebook-online.xinsiketang.com/reading/",
|
2025-01-08 11:00:20 +00:00
|
|
|
|
outputDir:process.env.BUILD_DIR? process.env.BUILD_DIR :"dist",
|
2024-06-13 00:50:28 +00:00
|
|
|
|
devServer: {
|
2025-01-08 11:00:20 +00:00
|
|
|
|
// headers: {
|
|
|
|
|
|
// 'Access-Control-Allow-Origin': '*',
|
|
|
|
|
|
// 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
|
|
|
|
|
|
// 'Access-Control-Allow-Headers': 'Content-Type, Authorization',
|
|
|
|
|
|
// },
|
|
|
|
|
|
// allowedHosts: "all",
|
2024-06-13 00:50:28 +00:00
|
|
|
|
proxy: {
|
2025-01-08 11:00:20 +00:00
|
|
|
|
'/api/app_dev.php': {
|
2025-03-13 02:53:59 +00:00
|
|
|
|
target: targetServer,
|
2025-01-08 11:00:20 +00:00
|
|
|
|
changeOrigin: true,
|
|
|
|
|
|
pathRewrite: {
|
|
|
|
|
|
'^/api/app_dev.php': '/app_dev.php'
|
|
|
|
|
|
},
|
|
|
|
|
|
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
|
|
|
|
'/api': {
|
2025-03-13 02:53:59 +00:00
|
|
|
|
target: targetServer,
|
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
|
|
|
|
},
|
2025-01-08 11:00:20 +00:00
|
|
|
|
|
|
|
|
|
|
'/baiduAi': {
|
|
|
|
|
|
target: 'https://qianfan.baidubce.com',
|
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
|
pathRewrite: {
|
|
|
|
|
|
'^/baiduAi': '/'
|
|
|
|
|
|
},
|
|
|
|
|
|
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-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)=>{
|
2025-03-13 02:53:59 +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
|
|
|
|
}
|