|
@@ -72,6 +72,7 @@ export default defineConfig<'webpack5'>(async (merge) => {
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
h5: {
|
|
h5: {
|
|
|
|
|
+ esnextModules: [],
|
|
|
publicPath: './',
|
|
publicPath: './',
|
|
|
staticDirectory: 'static',
|
|
staticDirectory: 'static',
|
|
|
output: {
|
|
output: {
|
|
@@ -96,7 +97,33 @@ export default defineConfig<'webpack5'>(async (merge) => {
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
|
|
+ // 2025.12.12 这一段解决的问题是在雷神模拟器上运行android时不支持es2020语法的问题
|
|
|
webpackChain(chain) {
|
|
webpackChain(chain) {
|
|
|
|
|
+ chain.module
|
|
|
|
|
+ .rule('force-es5')
|
|
|
|
|
+ .test(/\.(js|mjs)$/)
|
|
|
|
|
+ .include.add([
|
|
|
|
|
+ /node_modules[\\/]ahooks/,
|
|
|
|
|
+ /node_modules[\\/]lodash-es/,
|
|
|
|
|
+ /node_modules[\\/]dayjs/,
|
|
|
|
|
+ /node_modules[\\/]antd-mobile/,
|
|
|
|
|
+ /node_modules[\\/]@ant-design/,
|
|
|
|
|
+ /node_modules[\\/]@cornerstonejs/,
|
|
|
|
|
+ /node_modules[\\/]react-query/,
|
|
|
|
|
+ // ↑ 把自己项目里报错或输出 const/let 的包加进来就行
|
|
|
|
|
+ ])
|
|
|
|
|
+ .end()
|
|
|
|
|
+ .use('babel-loader')
|
|
|
|
|
+ .loader('babel-loader')
|
|
|
|
|
+ .options({
|
|
|
|
|
+ presets: [
|
|
|
|
|
+ ['@babel/preset-env', {
|
|
|
|
|
+ targets: { chrome: '91' }, // 或者 "iOS >= 9, Android >= 5"
|
|
|
|
|
+ useBuiltIns: 'usage',
|
|
|
|
|
+ corejs: 3,
|
|
|
|
|
+ }]
|
|
|
|
|
+ ]
|
|
|
|
|
+ });
|
|
|
// ✅ 优化:配置 Webpack 持久化缓存
|
|
// ✅ 优化:配置 Webpack 持久化缓存
|
|
|
chain.cache({
|
|
chain.cache({
|
|
|
type: 'filesystem',
|
|
type: 'filesystem',
|