fix: remove useless js-loader in front of mdx-loader #8972
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.
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
Before + SWC
After + Babel
After + SWC
Test Plan
Preview builds and run as before + unit tests
Test links
Deploy preview: https://deploy-preview-8972--docusaurus-2.netlify.app/