Skip to content

Conversation

@slorber
Copy link
Collaborator

@slorber slorber commented May 12, 2023

Motivation

It is not needed to put a js-loader (Babel/SWC) on top of the mdx compiler.

The output of MDX is already good to be run directly since MDX v2 and does not need any extra transpilation step (the JSX is now transpiled, unlike in MDX v1 output)

Site benchmark

I run some basic local tests by building our website locally.
Unfortunately, the impact of this perf improvement is not as significant as I hoped it to be.

Still, we see some improvement for the Docusaurus site when running on the default Babel JS Loader.
For SWC users, the impact is even smaller.

Before + Babel

  • 92s
  • 96s
  • 95s
  • 97s

Before + SWC

  • 87s
  • 85s
  • 81s
  • 86s

After + Babel

  • 90s
  • 90s
  • 91s
  • 91s

After + SWC

  • 84s
  • 85s
  • 84s
  • 83s

Test Plan

Preview builds and run as before + unit tests

Test links

Deploy preview: https://deploy-preview-8972--docusaurus-2.netlify.app/

@slorber slorber added the pr: performance This PR does not add a new behavior, but existing behaviors will be more memory- / time-efficient. label May 12, 2023
@slorber slorber requested review from Josh-Cena and lex111 as code owners May 12, 2023 14:06
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label May 12, 2023
@netlify
Copy link

netlify bot commented May 12, 2023

[V2]

Name Link
🔨 Latest commit e9f3537
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/645e47f514fa2800070930b3
😎 Deploy Preview https://deploy-preview-8972--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions
Copy link

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🟠 74 🟢 97 🟢 92 🟢 100 🟠 89 Report
/docs/installation 🟠 83 🟢 100 🟢 92 🟢 100 🟠 89 Report

@github-actions
Copy link

Size Change: +144 B (0%)

Total Size: 1.01 MB

Filename Size Change
website/build/assets/css/styles.********.css 113 kB +68 B (0%)
website/build/assets/js/main.********.js 752 kB +76 B (0%)
ℹ️ View Unchanged
Filename Size
website/.docusaurus/globalData.json 101 kB
website/build/index.html 41.3 kB

compressed-size-action

@slorber slorber merged commit d746f68 into main May 12, 2023
@slorber slorber deleted the slorber/remove-useless-js-loader-mdx branch May 12, 2023 14:31
@slorber slorber mentioned this pull request Jun 23, 2023
This was referenced Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA pr: performance This PR does not add a new behavior, but existing behaviors will be more memory- / time-efficient.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants