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

66 lines
2.1 KiB

const fs = require('fs')
const path = require('path')
const COMPONENTS_DIR_NAME = 'wxcomponents'
function getComponentsCopyOption () {
if (process.env.UNI_OUTPUT_TMP_DIR) { // TODO v3不需要,即将废弃
const componentsDir = path.resolve(process.env.UNI_INPUT_DIR, COMPONENTS_DIR_NAME)
if (fs.existsSync(componentsDir)) {
return {
from: componentsDir,
to: COMPONENTS_DIR_NAME,
ignore: ['**/*.vue', '**/*.css']
}
}
}
}
module.exports = {
options: {
extnames: { // TODO v3不需要此配置
style: '.wxss',
template: '.wxml',
filter: '.wxs'
},
filterTag: 'wxs',
subPackages: true
},
copyWebpackOptions (platformOptions, vueOptions) {
const copyOptions = []
const componentsCopyOption = getComponentsCopyOption()
if (componentsCopyOption) {
copyOptions.push(componentsCopyOption)
}
copyOptions.push('hybrid/html')
if (process.env.UNI_USING_V3) { // TODO 将仅保留v3逻辑
copyOptions.push(path.resolve(__dirname, '../dist/view.css'))
copyOptions.push(path.resolve(__dirname, '../dist/view.umd.min.js'))
// TODO 后续common与v3目录应该合并
copyOptions.push(path.resolve(__dirname, process.env.UNI_USING_NVUE_COMPILER ? '../template/common'
: '../template/weex'))
copyOptions.push(path.resolve(__dirname, '../template/v3'))
}
return copyOptions
},
chainWebpack (config, vueOptions) {
const isAppService = vueOptions.pluginOptions && !!vueOptions.pluginOptions['uni-app-plus'].service
if (isAppService) {
const subPackages = Object.keys(process.UNI_SUBPACKAGES)
if (process.env.UNI_OPT_SUBPACKAGES && subPackages.length) {
config
.plugin('uni-app-plus-subpackages')
.use(require('./plugin/sub-packages-plugin'))
}
}
if (process.env.NODE_ENV === 'production') {
config.optimization.minimizer('terser').tap((args) => {
if (!args[0].terserOptions.output) {
args[0].terserOptions.output = {}
}
args[0].terserOptions.output.ascii_only = true
return args
})
}
}
}