提交 0f32997c 编写于 作者: fxy060608's avatar fxy060608

feat(v3): add confusion

上级 5f6838dc
...@@ -10,6 +10,27 @@ const { ...@@ -10,6 +10,27 @@ const {
class WebpackUniAppPlugin { class WebpackUniAppPlugin {
apply(compiler) { 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) => { compiler.hooks.invalid.tap('webpack-uni-app-invalid', (fileName, changeTime) => {
if (fileName && typeof fileName === 'string') { if (fileName && typeof fileName === 'string') {
if (fileName.indexOf('.vue') !== -1 || fileName.indexOf('.nvue') !== -1) { if (fileName.indexOf('.vue') !== -1 || fileName.indexOf('.nvue') !== -1) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册