智能照明系统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/f7/f7ff49fa1b1e77f6dac867ca687...

24 lines
795 B

3 years ago
const isWin = /^win/.test(process.platform)
const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path)
function optimizeChunk(chunk) {
if (!chunk) {
return
}
const subPackages = Object.keys(process.UNI_SUBPACKAGES).map(root => `${root}/app-sub-service`)
const chunks = Array.from(chunk.groupsIterable)[0].chunks
Array.from(chunk.groupsIterable)[0].chunks = chunks.filter(chunk => !subPackages.includes(normalizePath(chunk.id)))
}
class SubPackagesPlugin {
apply(compiler) {
compiler.hooks.thisCompilation.tap('SubPackagesPlugin', compilation => {
compilation.hooks.afterOptimizeChunkIds.tap('SubPackagesPlugin', chunks => {
optimizeChunk(chunks.find(chunk => chunk.id === 'app-service'))
})
})
}
}
module.exports = SubPackagesPlugin