UNPKG

@mpxjs/webpack-plugin

Version:

mpx compile core

26 lines (23 loc) 804 B
const { isOriginTag, isBuildInWebTag } = require('../../../../utils/dom-tag-config') module.exports = function () { const handleComponentTag = (el, data) => { const newTag = `mpx-com-${el.tag}` const usingComponents = data.usingComponents || [] // 当前组件名与原生tag或内建tag同名,对组件名进行转义 // json转义见:platform/json/wx/index.js fixComponentName if (usingComponents.includes(newTag)) { el.tag = newTag } return el } return { waterfall: true, skipNormalize: true, supportedModes: ['web', 'ios', 'android', 'harmony'], test: (input) => isOriginTag(input) || isBuildInWebTag(input), web: handleComponentTag, ios: handleComponentTag, android: handleComponentTag, harmony: handleComponentTag } }