mirror of
https://gitee.com/ShopeX/ECShopX_mobile-frontend
synced 2026-08-08 13:25:31 +08:00
24 lines
769 B
JavaScript
24 lines
769 B
JavaScript
const ConcatSource = require('webpack-sources').ConcatSource
|
|
|
|
export default (ctx) => {
|
|
ctx.modifyBuildAssets((build) => {
|
|
// BA首页workaround
|
|
const taroJs = build.assets['taro.js']
|
|
if (taroJs) {
|
|
const source = taroJs.source()
|
|
let newSource
|
|
if (process.env.NODE_ENV === 'production') {
|
|
newSource = source.replace(/(\.eventSplitter=\/\\s\+\/;)/, '$1_wrapNativeSuper(Array);')
|
|
newSource = newSource.replace(
|
|
/(throw new Error\(\"Unable to resolve global \`this\`\"\))/,
|
|
'if(global)return global;$1'
|
|
)
|
|
} else {
|
|
newSource = source.replace('var RefsArray', '_wrapNativeSuper(Array);\nvar RefsArray')
|
|
}
|
|
|
|
build.assets['taro.js'] = new ConcatSource(newSource)
|
|
}
|
|
})
|
|
}
|