Skip to content

customize Link for mdx #4412

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

Conversation

chenxsan
Copy link
Member

@chenxsan chenxsan commented Jan 9, 2021

Improve website performance.

Why?

Let's take this page for example https://webpack.js.org/api/node/.

Open devtools and click the link in the screenshot below:

image

Here's the network panel:

image

Even with service worker, we still have a lot of requests.

Now let's open the preview of this pull request https://webpack-js-org-git-fork-chenxsan-feature-use-react-route-5aabb7.webpack-docs.vercel.app/api/node/, and click the same link:

image

That's impressive isn't it?

What's going on

This website is a Single Page React Application with precompiled HTML, but links in body are rendered as <a> elements, which would cause browser to load a whole new html page. When we render them as Link from react-router, it would dynamic load the needed part instead of loading a new html page, and it's possible with MDX. Guess this is a good reason to migrate from .md to .mdx because we have so many internal links.

@vercel
Copy link

vercel bot commented Jan 9, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/webpack-docs/webpack-js-org/i17uwv1dk
✅ Preview: https://webpack-js-org-git-fork-chenxsan-feature-use-react-route-5aabb7.webpack-docs.vercel.app

@chenxsan chenxsan marked this pull request as ready for review January 9, 2021 05:50
@chenxsan chenxsan requested a review from montogeek January 9, 2021 05:50
@montogeek montogeek added the UI/UX label Jan 9, 2021
@montogeek
Copy link
Member

Thanks!

@montogeek montogeek merged commit f0ce976 into webpack:master Jan 9, 2021
@chenxsan chenxsan deleted the feature/use-react-router-link-for-markdown-link branch January 9, 2021 13:01
@chenxsan chenxsan mentioned this pull request Jul 24, 2021
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants