智能照明系统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/35/35619cc32de6b08f4bb3bd831d8...

43 lines
1.1 KiB

3 years ago
const {
info,
done
} = require('@vue/cli-shared-utils')
const updateComponents = require('./component')
const updateApis = require('./api')
class WebpackOptimizePlugin {
apply (compiler) {
let optimized = false
compiler.hooks.beforeCompile.tapPromise('WebpackOptimizePlugin', compilation => {
return new Promise((resolve, reject) => {
if (!optimized) {
updateComponents(new Set())
updateApis(new Set(), new Set())
}
resolve()
})
})
compiler.hooks.shouldEmit.tap('WebpackOptimizePlugin', compilation => {
return optimized
})
compiler.hooks.done.tapPromise('WebpackOptimizePlugin', compilation => {
return new Promise((resolve, reject) => {
if (!optimized) {
console.log()
info('Build optimizing...')
optimized = true
updateComponents(process.UNI_TAGS || new Set())
updateApis(process.UNI_APIS || new Set(), process.UNI_USER_APIS || new Set())
} else {
done('Build complete.')
process.exit(0)
}
resolve()
})
})
}
}
module.exports = WebpackOptimizePlugin