update babel useBuiltIns

This commit is contained in:
fxy060608 2019-07-30 15:01:36 +08:00
parent 4656445949
commit abc0b71d1a
2 changed files with 27 additions and 28 deletions

View File

@ -1,28 +1,28 @@
const plugins = []
if (process.env.UNI_PLATFORM === 'app-plus' && process.env.UNI_USING_V8) {
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) {}
}
const plugins = []
if (process.env.UNI_PLATFORM === 'app-plus' && process.env.UNI_USING_V8) {
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 => {
@ -40,9 +40,9 @@ module.exports = {
presets: [
[
'@vue/app',
{
{
modules: 'commonjs',
useBuiltIns: 'entry'
useBuiltIns: process.env.UNI_PLATFORM === 'h5' ? 'usage' : 'entry'
}
]
],

View File

@ -1,4 +1,3 @@
const pkg = require('./package.json')
module.exports = {
parser: require('postcss-comment'),
plugins: [