amis-rpc-design/babel.config.js
2023-10-07 19:42:30 +08:00

33 lines
1022 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const isDev = process.env.NODE_ENV === 'development';
module.exports = {
// 执行顺序由右往左所以先处理ts再处理jsx,最后再试一下babel转换为低版本语法
"presets": [
[
"@babel/preset-env",
{
// 设置兼容目标浏览器版本,这里可以不写babel-loader会自动寻找上面配置好的文件.browserslistrc
// "targets": {
// "chrome": 35,
// "ie": 9
// },
"useBuiltIns": "usage", // 根据配置的浏览器兼容以及代码中使用到的api进行引入polyfill按需添加
"corejs": 3 // 配置使用core-js低版本
}
],
[
"@babel/preset-react",
{
"runtime": 'automatic'
}
],
"@babel/preset-typescript"
],
"plugins": [
// "babel-plugin-react-scoped-css",
isDev && require.resolve('react-refresh/babel'), // 配置react开发环境热替换
[
"@babel/plugin-proposal-decorators", { "legacy": true }
]
].filter(Boolean)
}