2020-10-19 08:43:10 +00:00
|
|
|
const { resolve } = require('./utils/projectHelper');
|
2018-03-18 11:59:38 +00:00
|
|
|
|
2021-06-23 15:08:16 +00:00
|
|
|
module.exports = function (modules) {
|
2018-03-18 11:59:38 +00:00
|
|
|
const plugins = [
|
2020-10-19 08:43:10 +00:00
|
|
|
[
|
|
|
|
resolve('@babel/plugin-transform-typescript'),
|
|
|
|
{
|
|
|
|
isTSX: true,
|
|
|
|
},
|
|
|
|
],
|
2021-04-20 02:38:19 +00:00
|
|
|
[resolve('@vue/babel-plugin-jsx'), { mergeProps: false, enableObjectSlots: false }],
|
2020-10-19 08:43:10 +00:00
|
|
|
resolve('@babel/plugin-proposal-optional-chaining'),
|
|
|
|
resolve('@babel/plugin-transform-object-assign'),
|
|
|
|
resolve('@babel/plugin-proposal-object-rest-spread'),
|
|
|
|
resolve('@babel/plugin-proposal-export-default-from'),
|
2020-10-19 09:17:10 +00:00
|
|
|
resolve('@babel/plugin-proposal-export-namespace-from'),
|
2020-10-19 08:43:10 +00:00
|
|
|
resolve('@babel/plugin-proposal-class-properties'),
|
|
|
|
resolve('@babel/plugin-syntax-dynamic-import'),
|
2021-06-28 09:53:45 +00:00
|
|
|
[
|
|
|
|
resolve('@babel/plugin-transform-runtime'),
|
|
|
|
{
|
|
|
|
useESModules: modules === false,
|
|
|
|
version: '^7.10.4',
|
|
|
|
},
|
|
|
|
],
|
2020-10-19 08:43:10 +00:00
|
|
|
// resolve('babel-plugin-inline-import-data-uri'),
|
|
|
|
// resolve('@babel/plugin-transform-member-expression-literals'),
|
|
|
|
// resolve('@babel/plugin-transform-property-literals'),
|
|
|
|
// resolve('@babel/plugin-proposal-export-default-from'),
|
|
|
|
// resolve('@babel/plugin-transform-object-assign'),
|
|
|
|
// resolve('@babel/plugin-transform-template-literals'),
|
|
|
|
// resolve('@babel/plugin-proposal-object-rest-spread'),
|
|
|
|
// resolve('@babel/plugin-proposal-class-properties'),
|
2019-01-12 03:33:27 +00:00
|
|
|
];
|
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
|
|
|
[
|
2020-10-19 08:43:10 +00:00
|
|
|
resolve('@babel/preset-env'),
|
2019-01-12 03:33:27 +00:00
|
|
|
{
|
|
|
|
modules,
|
|
|
|
targets: {
|
2021-06-28 09:53:45 +00:00
|
|
|
browsers: ['last 2 versions', 'Firefox ESR', '> 1%', 'not ie 11'],
|
2019-01-12 03:33:27 +00:00
|
|
|
},
|
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: {
|
2020-10-19 08:43:10 +00:00
|
|
|
plugins: [resolve('babel-plugin-istanbul')],
|
2018-04-24 10:46:06 +00:00
|
|
|
},
|
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
};
|
|
|
|
};
|