merge
Change-Id: I5227831adac7f85854cbe7321c2a3aa39d8c1d7a
diff --git a/scripts/webpack.base.js b/scripts/webpack.base.js
index ff3ca32..5224c08 100644
--- a/scripts/webpack.base.js
+++ b/scripts/webpack.base.js
@@ -15,6 +15,8 @@
output: {
path: path.resolve(__dirname, '../dist'), // 打包后的代码放在dist目录下
filename: '[name].[contenthash:8].js', // 打包的文件名
+
+ publicPath: '/',
},
resolve: {
alias: {
@@ -143,9 +145,14 @@
new CircularDependencyPlugin({
exclude: /node_modules/,
include: /src/,
- failOnError: true,
+ failOnError: true,
allowAsyncCycles: false,
cwd: process.cwd(),
+ }),
+ new webpack.DefinePlugin({
+ // 确保基础变量存在
+ 'process.platform': JSON.stringify(platform()),
+ 'process.browser': JSON.stringify(true)
})
]
}
\ No newline at end of file
diff --git a/scripts/webpack.dev.js b/scripts/webpack.dev.js
index c5feb8d..eeb400a 100644
--- a/scripts/webpack.dev.js
+++ b/scripts/webpack.dev.js
@@ -14,7 +14,7 @@
'process.env': JSON.stringify({
NODE_ENV: 'development', // 等价于 mode 设置
PUBLIC_URL: './', // 建议使用相对路径
- API_BASE_URL: 'http://localhost:3030/api', // 添加API路径
+ API_BASE_URL: 'http://localhost:5008', // 添加API路径
WEB_BASE_URL: 'http://localhost:8080', // 添加WEB路径
})
}),
diff --git a/scripts/webpack.prod.js b/scripts/webpack.prod.js
index 0de8641..88ac0ba 100644
--- a/scripts/webpack.prod.js
+++ b/scripts/webpack.prod.js
@@ -3,4 +3,14 @@
module.exports = merge(base, {
mode: 'production', // 生产模式
+ plugins: [
+ new webpack.DefinePlugin({
+ 'process.env': JSON.stringify({
+ NODE_ENV: 'production', // 等价于 mode 设置
+ PUBLIC_URL: './', // 建议使用相对路径
+ API_BASE_URL: 'http://localhost:5008', // 添加API路径
+ WEB_BASE_URL: 'http://localhost:8080', // 添加WEB路径
+ })
+ }),
+ ],
})
\ No newline at end of file