Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let's remove outdated @babel/plugin-proposal-xxx in modern build? #36794

Closed
2 tasks done
kkocdko opened this issue Apr 7, 2023 · 1 comment · Fixed by #36795
Closed
2 tasks done

Let's remove outdated @babel/plugin-proposal-xxx in modern build? #36794

kkocdko opened this issue Apr 7, 2023 · 1 comment · Fixed by #36795
Assignees
Labels
core Infrastructure work going on behind the scenes dependencies Update of dependencies enhancement This is not a bug, nor a new feature

Comments

@kkocdko
Copy link
Contributor

kkocdko commented Apr 7, 2023

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Summary 💡

In a word, some @babel/plugin-proposal-xxx in babel.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 (like const { a, ...others } = obj) in modern build is also transpiled to use babel's polyfill (_objectWithoutProperties(xxx)). See modern/Accordion in unpkg.

This's because of:

// Need the following 3 proposals for all targets in .browserslistrc.
// With our usage the transpiled loose mode is equivalent to spec mode.
['@babel/plugin-proposal-class-properties', { loose: true }],
['@babel/plugin-proposal-private-methods', { loose: true }],
['@babel/plugin-proposal-private-property-in-object', { loose: true }],
['@babel/plugin-proposal-object-rest-spread', { loose: true }],

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, the node and legacy build, was not changed.

Examples 🌈

No response

Motivation 🔦

Smaller bundle size & better performance on modern platform.

@kkocdko kkocdko added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Apr 7, 2023
@kkocdko
Copy link
Contributor Author

kkocdko commented Apr 7, 2023

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.

@zannager zannager added the package: system Specific to @mui/system label Apr 10, 2023
@mnajdova mnajdova assigned michaldudak and unassigned mnajdova Apr 10, 2023
@ZeeshanTamboli ZeeshanTamboli added dependencies Update of dependencies core Infrastructure work going on behind the scenes enhancement This is not a bug, nor a new feature and removed package: system Specific to @mui/system status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes dependencies Update of dependencies enhancement This is not a bug, nor a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants