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

46 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-01-12 03:33:27 +00:00
'use strict';
2018-03-18 11:59:38 +00:00
2019-01-12 03:33:27 +00:00
module.exports = function(modules) {
2018-03-18 11:59:38 +00:00
const plugins = [
2018-03-19 11:09:30 +00:00
require.resolve('babel-plugin-transform-vue-jsx'),
require.resolve('babel-plugin-inline-import-data-uri'),
2018-03-19 09:51:47 +00: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 11:10:43 +00:00
require.resolve('babel-plugin-transform-class-properties'),
2019-01-12 03:33:27 +00:00
];
plugins.push([
require.resolve('babel-plugin-transform-runtime'),
{
polyfill: false,
},
]);
2018-03-18 11:59:38 +00:00
return {
2018-03-19 09:51:47 +00:00
presets: [
2019-01-12 03:33:27 +00:00
[
require.resolve('babel-preset-env'),
{
modules,
targets: {
browsers: [
'last 2 versions',
'Firefox ESR',
'> 1%',
'ie >= 9',
'iOS >= 8',
'Android >= 4',
],
},
2018-03-19 09:51:47 +00:00
},
2019-01-12 03:33:27 +00:00
],
2018-03-19 09:51:47 +00:00
],
2018-03-18 11:59:38 +00:00
plugins,
2018-04-24 10:46:06 +00:00
env: {
test: {
plugins: [require.resolve('babel-plugin-istanbul')],
},
},
2019-01-12 03:33:27 +00:00
};
};