提交 c76624b3 编写于 作者: Q qiang

fix(mp-alipay): 修复支付宝小程序配置全局小程序组件后编译报错的问题 #3619

上级 8a100f41
...@@ -294,8 +294,8 @@ module.exports = function generateComponent (compilation, jsonpFunction = 'webpa ...@@ -294,8 +294,8 @@ module.exports = function generateComponent (compilation, jsonpFunction = 'webpa
// fix mp-alipay plugin // fix mp-alipay plugin
if (process.env.UNI_PLATFORM === 'mp-alipay' && appJsonFile) { if (process.env.UNI_PLATFORM === 'mp-alipay' && appJsonFile) {
const obj = JSON.parse(appJsonFile.source()) const obj = JSON.parse(appJsonFile.source())
if (obj && obj.usingComponents && !Object.keys(obj.usingComponents).length) { const componentName = 'plugin-wrapper'
const componentName = 'plugin-wrapper' if (obj && obj.usingComponents && !(componentName in obj.usingComponents)) {
obj.usingComponents[componentName] = `/${componentName}` obj.usingComponents[componentName] = `/${componentName}`
const source = JSON.stringify(obj, null, 2) const source = JSON.stringify(obj, null, 2)
if (webpack.version[0] > 4) { if (webpack.version[0] > 4) {
......
...@@ -159,7 +159,7 @@ module.exports = function generateJson (compilation) { ...@@ -159,7 +159,7 @@ module.exports = function generateJson (compilation) {
}) })
} }
// fix mp-alipay plugin // fix mp-alipay plugin
if (process.env.UNI_PLATFORM === 'mp-alipay') { if (process.env.UNI_PLATFORM === 'mp-alipay' && name !== 'app.json') {
const usingComponents = jsonObj.usingComponents || {} const usingComponents = jsonObj.usingComponents || {}
if (Object.values(usingComponents).find(value => value.startsWith('plugin://'))) { if (Object.values(usingComponents).find(value => value.startsWith('plugin://'))) {
const componentName = 'plugin-wrapper' const componentName = 'plugin-wrapper'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册