test(react-icons-atomic-webpack-loader): verify fixtures against rspack - #1224
Open
Martin Hochel (Hotell) wants to merge 2 commits into
Open
test(react-icons-atomic-webpack-loader): verify fixtures against rspack#1224Martin Hochel (Hotell) wants to merge 2 commits into
Martin Hochel (Hotell) wants to merge 2 commits into
Conversation
📋 PR Validation SummaryCheck the Build react library job summary for detailed reports:
|
Martin Hochel (Hotell)
force-pushed
the
feat/atomic-loader-rspack-harness
branch
from
August 25, 2026 16:43
3dd3a2b to
e178c85
Compare
Mirrors the harness added for the font subsetting plugin: the fixture entries and
their assertions move into a shared `test/make-configs.js`, and `test/run.js`
(`--bundler webpack|rspack|all`) drives both bundlers over the same 17 entries.
All 17 pass under rspack with no per-bundler assertion overrides, including the
`ts-loader` rule, `experiments.outputModule` with `library: { type: 'module' }`,
and the emitted-warning assertions. The rspack config deliberately keeps the same
ts-loader setup as webpack so any difference would come from the bundler rather
than the TypeScript toolchain. `make-configs.js` supports `overrides.<bundler>`
should a future divergence need it.
One behavioural fix was required: the assertion plugin read warnings via
`w instanceof Error ? w.message : String(w)`, and rspack surfaces RspackError
objects rather than Error instances, which would have stringified to garbage
instead of failing. It now reads `message` directly.
Also drops `import type { LoaderContext } from 'webpack'`, which was preserved in
`lib/index.d.ts` and would break type-checking for consumers who install only
`@rspack/core` now that both are optional peers. Replaced by a hand-maintained
`AtomicLoaderContext` covering the four members the loader uses, with
`test/types.conformance.ts` asserting both bundlers' real loader contexts still
satisfy it.
Aligns the `@rspack/core` peer range with the font subsetting plugin, per review feedback on microsoft#1219. The loader itself only touches the loader context (`getOptions`, `callback`, `emitWarning`, `resourcePath`), which has been stable since rspack 1.x, so a lower floor would technically work. But 2.1.0 is the only version this suite exercises, and advertising untested versions is what produced the incorrect range on the plugin. Declaring the version we actually verify keeps the two packages consistent for consumers who install both.
Martin Hochel (Hotell)
force-pushed
the
feat/atomic-loader-rspack-harness
branch
from
August 25, 2026 17:54
e178c85 to
2afa22f
Compare
Martin Hochel (Hotell)
marked this pull request as ready for review
August 25, 2026 19:09
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.
Why
@fluentui/react-icons-atomic-webpack-loaderwas only ever exercised against webpack. Since #1219established rspack support for the font subsetting plugin, that claim should be tested here too
rather than assumed.
Change
The fixture entries and their assertions move into a shared
test/make-configs.js, andtest/run.js(--bundler webpack|rspack|all) drives both bundlers over the same 17 entries.test/webpack.config.jsbecomes a thin wrapper, so the existing webpack behaviour is unchanged.The rspack config deliberately keeps the same
ts-loadersetup as webpack rather than switchingto
builtin:swc-loader, so that any difference in emitted output comes from the bundler rather thanfrom a different TypeScript toolchain.
Result: no per-bundler overrides were needed
All 17 entries pass under rspack unmodified, including the three things I expected to be risky:
ts-loaderunder rspack (.jsx/.tsxfixtures)experiments.outputModule+library: { type: 'module' }mustInclude/mustExcludestring assertion holdsdynamic-barrel-imports)make-configs.jsstill supportsoverrides.<bundler>so a future divergence has somewhere to go,but nothing uses it today.
One real bug found
The assertion plugin read warnings as:
rspack surfaces
RspackErrorobjects rather thanErrorinstances, so this would have fallen intothe
String(w)branch and produced[object Object]— themustWarnassertions would have failedconfusingly rather than reporting the real warning. Now reads
messagedirectly, which is correctfor both bundlers.
Type leak fixed
lib/index.d.tscarriedimport type { LoaderContext } from 'webpack'. With both bundlers nowdeclared as optional peers, an rspack-only consumer would hit
Cannot find module 'webpack'while type-checking — the same defect fixed in #1219 for the font plugin.
Replaced with a hand-maintained
AtomicLoaderContextcovering the four members the loader actuallyuses (
resourcePath,getOptions,callback,emitWarning), plustest/types.conformance.tsasserting that both bundlers' realLoaderContextstill satisfiesit. Verified the check is not vacuous: adding a member no bundler has fails compilation for both.
Peer range
@rspack/coreis declared as>=2.1.0, matching the font plugin. The loader itself only touches theloader context, which has been stable since rspack 1.x, so a lower floor would technically work — but
2.1.0 is the only version this suite exercises, and advertising untested versions is what produced
the incorrect range caught in review on #1219.
Verification
nx run …:test— vitest + type conformance + webpack 17/17 + rspack 17/17mustIncludefails under rspack with[rspack/svg-imports] Expected output to contain "THIS-SHOULD-NOT-EXIST", proving the rspack pathactually evaluates assertions rather than passing vacuously
dynamic-barrel-imports)nx run …:lint,yarn deps:check, andyarn install --immutableall pass