chore: modify the babel configuration (#6532)

* chore: modify the babel configuration

* fix: 参考 antd-tools 的代码
pull/6542/head
gongshun 2023-05-07 20:39:19 +08:00 committed by GitHub
parent 045193e797
commit 1deefa8b7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -1,4 +1,4 @@
const { resolve } = require('./utils/projectHelper'); const { resolve, isThereHaveBrowserslistConfig } = require('./utils/projectHelper');
module.exports = function (modules) { module.exports = function (modules) {
const plugins = [ const plugins = [
@ -38,9 +38,11 @@ module.exports = function (modules) {
resolve('@babel/preset-env'), resolve('@babel/preset-env'),
{ {
modules, modules,
targets: { targets: isThereHaveBrowserslistConfig()
browsers: ['last 2 versions', 'Firefox ESR', '> 1%', 'not ie 11'], ? undefined
}, : {
browsers: ['last 2 versions', 'Firefox ESR', '> 1%', 'ie >= 11'],
},
}, },
], ],
], ],