Repository navigation
Conversation
… text imports
Replace the `with: {type: {not: 'text'}}` exclusions of every Docusaurus rule
by a single Rspack rule matching the subsequent rules against
`[resource-path].text`. Webpack doesn't support `as`: its text imports are
processed by loaders again in this prototype.
Upgrade @rspack/core to 2.3.2, the first version with `rules[].as`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
✅ [V2]
To edit notification comments on pull requests, go to your Netlify project configuration. |
⚡️ Lighthouse report for the deploy preview of this PR
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Prototype of the new experimental Rspack
rules[].asoption (Rspack 2.3.2), suggested by the Rspack team to simplify matching rules for import attributes.Text imports (
import x from './file.js' with {type: 'text'}) get theasset/sourcetype from a default rule, but the loaders of all the other matching rules still apply. Today each Docusaurus rule excludes them withwith: {type: {not: 'text'}}(core JS/CSS/assets rules, MDX loader, SVGR, ideal-image, synthetic MDX fallback). Third-party plugin rules must do the same.With
as, a single rule placed first does it for all subsequent rules, including the ones added by plugins:The subsequent rules match
file.js.textinstead offile.js, so none of them apply. Loaders and file reading still use the original resource.as. This prototype removes the per-rule exclusions, so webpack text imports are broken here: the webpack (DOCUSAURUS_SLOWER) website build is expected to fail on the import attributes dogfood page. Landing it would require keeping the exclusions for webpack, or dropping webpack support.Test Plan
@rspack/coreto 2.3.2, the first version supportingasasrule removed: ❌Text import attribute test failed for JS, proving the page exercises the ruleTest links
Deploy preview: https://deploy-preview-13056--docusaurus-2.netlify.app/tests/pages/import-attributes
Related issues/PRs
🤖 Generated with Claude Code