chore: modify the babel configuration #6532
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
按照文档和这个 babel 配置,打包后的组件代码应该是不需要转 es6 代码的,但是实际上是转换了
如果不配置 @babel/preset-env 的 targets ,就会使用 package.json 中 browserslist 字段,此时打包后的代码就是正确的(无需转换 es6 的代码)
参考 https://github.com/ant-design/antd-tools/blob/6d4722ad12e46148bbc1b0656072c1c3e4b5cdf8/lib/getBabelCommonConfig.js#L31