ant-design-vue/antd-tools/getBabelCommonConfig.js

39 lines
1010 B
JavaScript
Raw Normal View History

2018-03-18 19:59:38 +08:00
'use strict'
module.exports = function (modules) {
const plugins = [
2018-03-19 19:09:30 +08:00
require.resolve('babel-plugin-transform-vue-jsx'),
2018-03-19 17:51:47 +08:00
require.resolve('babel-plugin-transform-es3-member-expression-literals'),
require.resolve('babel-plugin-transform-es3-property-literals'),
require.resolve('babel-plugin-transform-object-assign'),
require.resolve('babel-plugin-transform-object-rest-spread'),
2018-05-03 19:10:43 +08:00
require.resolve('babel-plugin-transform-class-properties'),
2018-03-18 19:59:38 +08:00
]
2018-03-19 17:51:47 +08:00
plugins.push([require.resolve('babel-plugin-transform-runtime'), {
polyfill: false,
}])
2018-03-18 19:59:38 +08:00
return {
2018-03-19 17:51:47 +08:00
presets: [
[require.resolve('babel-preset-env'), {
modules,
targets: {
browsers: [
'last 2 versions',
'Firefox ESR',
'> 1%',
'ie >= 9',
'iOS >= 8',
'Android >= 4',
],
},
}],
],
2018-03-18 19:59:38 +08:00
plugins,
2018-04-24 18:46:06 +08:00
env: {
test: {
plugins: [require.resolve('babel-plugin-istanbul')],
},
},
2018-03-18 19:59:38 +08:00
}
}