add babel-plugin-console

This commit is contained in:
fxy060608 2019-04-16 14:26:45 +08:00
parent 35d8fd5537
commit 42419694f4
2 changed files with 27 additions and 2 deletions

View File

@ -35,7 +35,7 @@ module.exports = (api, options, rootOptions) => {
api.extendPackage(pkg => {
return {
dependencies: {
'regenerator-runtime':'^0.12.1'//锁定版本,避免高版本在小程序中出错
'regenerator-runtime': '^0.12.1'// 锁定版本,避免高版本在小程序中出错
}
}
})

View File

@ -1,4 +1,29 @@
const plugins = []
const plugins = []
if (process.env.UNI_PLATFORM === 'app-plus') {
const path = require('path')
const isWin = /^win/.test(process.platform)
const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path)
const input = normalizePath(process.env.UNI_INPUT_DIR)
try {
plugins.push([
require('@dcloudio/vue-cli-plugin-hbuilderx/packages/babel-plugin-console'),
{
file (file) {
file = normalizePath(file)
if (file.indexOf(input) === 0) {
return path.relative(input, file)
}
return false
}
}
])
} catch (e) {}
}
process.UNI_LIBRARIES = process.UNI_LIBRARIES || ['@dcloudio/uni-ui']
process.UNI_LIBRARIES.forEach(libraryName => {
plugins.push([