智能照明系统APP-本地串口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
LightingSystemApp-serial/.svn/pristine/03/03a5b880008073dbc4f8562db13...

57 lines
1.8 KiB

const {
initAutoImportScanComponents
} = require('@dcloudio/uni-cli-shared/lib/pages')
let compiling = false
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 (!process.env.UNI_USING_V3) {
if (!compiling) {
compiling = true
console.log('开始差量编译...')
}
}
if (fileName && typeof fileName === 'string') {
if (fileName.indexOf('.vue') !== -1 || fileName.indexOf('.nvue') !== -1) {
if (process.UNI_AUTO_SCAN_COMPONENTS) {
initAutoImportScanComponents()
}
}
}
})
// v3 版本在webpack-app-plus-plugin/index.js中处理,目前太乱了。后续要整理
if (!process.env.UNI_USING_V3) {
compiler.hooks.done.tapPromise('webpack-uni-app-done', compilation => {
return new Promise((resolve, reject) => {
compiling = false
resolve()
})
})
}
}
}
module.exports = WebpackUniAppPlugin