diff --git a/packages/webpack-uni-mp-loader/lib/plugin/generate-component.js b/packages/webpack-uni-mp-loader/lib/plugin/generate-component.js index f49deac6252ddc066ea0fd949c582782eeadfdac..e6b0edb7621bd8d4c71b6c0e56c1f9c92b10000d 100644 --- a/packages/webpack-uni-mp-loader/lib/plugin/generate-component.js +++ b/packages/webpack-uni-mp-loader/lib/plugin/generate-component.js @@ -294,8 +294,8 @@ module.exports = function generateComponent (compilation, jsonpFunction = 'webpa // fix mp-alipay plugin if (process.env.UNI_PLATFORM === 'mp-alipay' && appJsonFile) { 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}` const source = JSON.stringify(obj, null, 2) if (webpack.version[0] > 4) { diff --git a/packages/webpack-uni-mp-loader/lib/plugin/generate-json.js b/packages/webpack-uni-mp-loader/lib/plugin/generate-json.js index 2ec810b484e3f6dda471fc30778d545aa05f7df9..f15a9efb369ee21d66e9962167cc4dd931ee81d3 100644 --- a/packages/webpack-uni-mp-loader/lib/plugin/generate-json.js +++ b/packages/webpack-uni-mp-loader/lib/plugin/generate-json.js @@ -159,7 +159,7 @@ module.exports = function generateJson (compilation) { }) } // 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 || {} if (Object.values(usingComponents).find(value => value.startsWith('plugin://'))) { const componentName = 'plugin-wrapper'