diff --git a/packages/vue-cli-plugin-uni/packages/webpack-uni-app-loader/plugin/index.js b/packages/vue-cli-plugin-uni/packages/webpack-uni-app-loader/plugin/index.js index a05b203d81e6ea03a73e41400724ab016cb81d26..73892e102d17c8437c87b20eff92fd1a5b44a2e2 100644 --- a/packages/vue-cli-plugin-uni/packages/webpack-uni-app-loader/plugin/index.js +++ b/packages/vue-cli-plugin-uni/packages/webpack-uni-app-loader/plugin/index.js @@ -10,6 +10,27 @@ const { class WebpackUniAppPlugin { apply(compiler) { + if (process.UNI_CONFUSION) { + compiler.hooks.emit.tapPromise('webpack-uni-app-emit', compilation => { + return new Promise((resolve, reject) => { + if (compilation.assets['app-confusion.js']) { //存在加密 + const manifestJson = JSON.parse(`${compilation.assets['manifest.json'].source()}`) + manifestJson.plus.confusion.resources['app-confusion.js'] = {} + const source = JSON.stringify(manifestJson) + compilation.assets['manifest.json'] = { + size() { + return Buffer.byteLength(source, 'utf8') + }, + source() { + return source + } + } + } + resolve() + }) + }) + } + compiler.hooks.invalid.tap('webpack-uni-app-invalid', (fileName, changeTime) => { if (fileName && typeof fileName === 'string') { if (fileName.indexOf('.vue') !== -1 || fileName.indexOf('.nvue') !== -1) {