Skip to content

Update docusaurus and use v4 future#3195

Open
liuxingbaoyu wants to merge 6 commits into
babel:mainfrom
liuxingbaoyu:docusaurus-310
Open

Update docusaurus and use v4 future#3195
liuxingbaoyu wants to merge 6 commits into
babel:mainfrom
liuxingbaoyu:docusaurus-310

Conversation

@liuxingbaoyu
Copy link
Copy Markdown
Member

This PR can be reviewed commit by commit.
This PR used codex to help me perform batch replacements.

liuxingbaoyu and others added 5 commits April 27, 2026 16:46
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 27, 2026

👷 Deploy request for babel-next pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 082941c

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 27, 2026

Deploy Preview for babel ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 082941c
🔍 Latest deploy log https://app.netlify.com/projects/babel/deploys/69f05885278e320008afd574
😎 Deploy Preview https://deploy-preview-3195--babel.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 project configuration.

Comment thread website/.browserslistrc Outdated
@@ -1 +1 @@
defaults
defaults and supports css-cascade-layers
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default browser target will convert the default CSS to :root:not(#\#):not(#\#) {...}, which means that custom CSS cannot override them without modification.
@slorber This might be a common issue with useCssCascadeLayers, and you might be interested in it. :)

Copy link
Copy Markdown
Contributor

@JLHwung JLHwung Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we already have latest caniuse-lite in the lock file? Chances are defaults already supports css-cascade-layers but the definition of defaults in the lock file lags behind.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right! After my update, defaults is now supported.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:not(#\#) is a way for postCSS to downgrade CSS cascade layers to "older CSS". Technically each :not(#\#) helps increase the selector specificity.

CSS Cascade layers are well supported now, however if you need to downgrade and keep your CSS overrides, I'd recommend adding a layer to your site's custom CSS so that :not(#\#) is also added to your own CSS so that it gets a higher specificity.

But yeah, if it's in defaults it's just simpler to upgrade.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@slorber
Copy link
Copy Markdown
Contributor

slorber commented Apr 28, 2026

Hey 👋

TLDR: I think you should break this PR into multiple smaller ones that focus on a single thing at a time. This makes it easier to review/merge, and it helps me helps you if you need.


v3.10 doesn't ship any breaking change, it's only if you use our v4 "future flags" that you opt in into future breaking changes purposefully. One strategy could be to opt in to each breaking change in an individual PR that focuses on a single change at a time.

Note that you do not need to migrate all your files to .mdx, it's just a recommendation. Also, Docusaurus v4 will preserve compatibility options with MDX v1, so you don't really need to change/rename all your MDX files in this PR as part of the upgrade.

My suggestion would be:

  • upgrade to v3.10 only, no breaking change

Optional:

  • enable v4.useCssCascadeLayers, fix possible CSS issues
  • disable siteConfig.markdown.mdx1Compat individual options one by one in separate PRs (migrate to admonition directives, mdx comments, mdx heading ids in separate focused PRs)
  • rename all extensions/links to .mdx (unless you purposefully want to use CommonMark for some docs)
  • enable v4: true if you have successfully handled all the individual v4 future flags

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants