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

[docs-infra] Remove all ES6 transpilation features #42385

Open
oliviertassinari opened this issue May 24, 2024 · 1 comment
Open

[docs-infra] Remove all ES6 transpilation features #42385

oliviertassinari opened this issue May 24, 2024 · 1 comment
Assignees
Labels
performance scope: docs-infra Specific to the docs-infra product

Comments

@oliviertassinari
Copy link
Member

oliviertassinari commented May 24, 2024

Summary

The docs transform modern JavaScript features for old browsers, but it's not necessary.

https://pagespeed.web.dev/analysis?url=https%3A%2F%2Fmaster--material-ui.netlify.app%2F

SCR-20240508-qkhd

Lighthouse uses Cannot call a class as a function to detect https://babeljs.io/docs/babel-plugin-transform-classes https://github.com/GoogleChrome/lighthouse/blob/369979f498bd6560127e10476edffb264d4fa3b9/core/audits/byte-efficiency/legacy-javascript.js#L301C22-L301C55.

Seeing this on https://master--material-ui.netlify.app/ is wrong:

SCR-20240508-tytg

We should at minimum go into loose mode: https://github.com/vercel/next.js/blob/5ff2731c589692ed86379f876a38e1ca46f5761e/packages/next/src/build/babel/preset.ts#L161.

Examples

As you can see from https://codesandbox.io/p/sandbox/loving-goodall-f5p6nl?file=%2Fsrc%2Fcomponents%2FApp.js%3A13%2C26 the loose mode already has a good bundle size reduction impact.

Motivation

A better docs experience. Upstream dependency with Next.js vercel/next.js#65540. Moving to SWC could be enough otherwise.

Search keywords: -

@oliviertassinari oliviertassinari added performance status: waiting for maintainer These issues haven't been looked at yet by a maintainer scope: docs-infra Specific to the docs-infra product labels May 24, 2024
@oliviertassinari oliviertassinari changed the title [docs-infra] Remove all ES6 transpilation features. [docs-infra] Remove all ES6 transpilation features May 24, 2024
@siriwatknp siriwatknp assigned Janpot and unassigned siriwatknp Nov 13, 2024
@DiegoAndai DiegoAndai removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 13, 2024
@Janpot
Copy link
Member

Janpot commented Feb 4, 2025

Doesn't look like we ourselves are transforming with this plugin anymore. However I do see it popping up in external packages such as @docsearch/react. Nevertheless, since we remove babel-macros, we can now think about disabling babel for the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance scope: docs-infra Specific to the docs-infra product
Projects
None yet
Development

No branches or pull requests

4 participants