diff --git a/build/build.js b/build/build.js index e861e360d228136b63353ccef0c8763d5d905bd3..ce684dd540bbb9f282ae14d80317ef627f60b990 100644 --- a/build/build.js +++ b/build/build.js @@ -13,6 +13,8 @@ const { generateApiManifest } = require('./manifest') +const fixInnerHTML = require('./fixInnerHTML') + const service = new Service(process.env.VUE_CLI_CONTEXT || process.cwd(), { inlineOptions: require('./vue.config.js') }) @@ -53,6 +55,9 @@ service.run('build', { JSON.parse(JSON.stringify(process.UNI_SERVICE_API_PROTOCOL)) ) } + if (process.env.UNI_PLATFORM === 'app-plus' && process.env.UNI_VIEW === 'true' && process.env.UNI_WATCH !== 'true') { + fixInnerHTML() + } }).catch(err => { error(err) process.exit(1) @@ -85,4 +90,4 @@ if (process.env.UNI_PLATFORM === 'h5' && process.env.UNI_WATCH === 'false') { .catch(err => { throw err }) -} +} diff --git a/build/fixInnerHTML.js b/build/fixInnerHTML.js new file mode 100644 index 0000000000000000000000000000000000000000..4ecfbeba08c19468e7cb0b09f2fb6f06dfc02635 --- /dev/null +++ b/build/fixInnerHTML.js @@ -0,0 +1,18 @@ +const path = require('path') +const fs = require('fs') + +module.exports = function () { + const files = [ + path.join(__dirname, '../packages/uni-app-plus/dist/view.umd.min.js'), + path.join(__dirname, '../packages/uni-app-plus/template/v3/__uniappquill.js'), + path.join(__dirname, '../packages/uni-app-plus/template/v3/__uniappquillimageresize.js') + ] + files.forEach(filePath => { + const fileContent = fs.readFileSync(filePath, { + encoding: 'utf8' + }) + fs.writeFileSync(filePath, fileContent.replace(/\.innerHTML\b/g, '["inner"+"HTML"]'), { + encoding: 'utf8' + }) + }) +}