Closed kkocdko closed 1 year ago
So what I want is: remove the plugins that already included in @babel/preset-env
. This will be a small change, should I take a PR?
I think this change is still follow our compatibility promise, so no breaking changes happen.
Duplicates
Latest version
Summary 💡
In a word, some
@babel/plugin-proposal-xxx
inbabel.config.js
maybe outdated and should be removed.Docs said "the
modern
folder targets the latest released versions of evergreen browsers". However I found the rest property (likeconst { a, ...others } = obj
) inmodern
build is also transpiled to use babel's polyfill (_objectWithoutProperties(xxx)
). See modern/Accordion in unpkg.This's because of:
https://github.com/mui/material-ui/blob/9f5ae34c2454b600347417bf3d6037d1390df9d0/babel.config.js#L65-L70
These code was written 3 years ago, at that time these syntaxes were still in the proposal stage.
In babel's docs of object-rest-spread plugin, "This plugin is included in
@babel/preset-env
, in ES2018" (and some others were included in ES2021 or 2022). So I try to remove these line of code. The output is satisfied, without polyfill. Certainly, thenode
andlegacy
build, was not changed.Examples 🌈
No response
Motivation 🔦
Smaller bundle size & better performance on modern platform.