-
Notifications
You must be signed in to change notification settings - Fork 165
fix(repack): wrap babel-loader fallback value in an array - #1456
fix(repack): wrap babel-loader fallback value in an array #1456ilteoood wants to merge 1 commit into
Conversation
@ilteoood is attempting to deploy a commit to the Callstack Team on Vercel.
A member of the Team first needs to authorize it.
🦋 Changeset detectedLatest commit: 02ecf58 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Rspack's resolver and downstream tools that consume the resolved loader
config (notably `RSDoctor`) expect `resolveLoader.fallback[name]` to be
an array; a bare string triggered
`Given napi value is not an array on NapiResolveOptions.fallback`. The
record form is unchanged — only the value for `babel-loader` is now
wrapped in a single-element array. This matches Rspack's `ResolveAlias`
shape (`{ [x: string]: string | false | (string | false)[] }`) and
Webpack's resolve loader fallback shape.
Closes callstack#1455
d00285b to
02ecf58
Compare
dannyhw
commented
Sep 8, 2026
@ilteoood is it due to some change is rspack or it was already incorrect before?
ilteoood
commented
Sep 8, 2026
@ilteoood is it due to some change is rspack or it was already incorrect before?
I think some changes have been made on rspack, because the first time I configured it it was working fine.
ilteoood
commented
Sep 9, 2026
FYI I've also opened this
dannyhw
commented
Sep 9, 2026
Seems like on rsdoctor they merged a fix referencing your issue do you think it will be resolved by that?
ilteoood
commented
Sep 9, 2026
Not 100%: when the napi bridge is invoked directly it will still throw an error.
I know for sure that the fix we have here always works: it's the same one I've applied in my local patches.
Uh oh!
There was an error while loading. Please reload this page.
Summary
BabelPluginpreviously setresolveLoader.fallback['babel-loader']to a bare string path (e.g./path/to/babel-loader). Rspack's resolver and downstream tooling that consumes the resolved loader config (notablyRSDoctor) expects the value to be an array, so the bare string caused:The fix wraps the value in a single-element array. The record shape is unchanged, which still satisfies:
ResolveAlias = { [x: string]: string | false | (string | false)[] } | false{ [name]: string | false | string[] })Changes
packages/repack/src/plugins/BabelPlugin.ts— wraprequire.resolve('babel-loader')in[ ]so the value isstring[]rather thanstring.packages/repack/src/plugins/__tests__/BabelPlugin.test.ts— new tests covering the empty and pre-populated record paths..changeset/babel-loader-resolve-loader-fallback-array.md— patch changeset for@callstack/repack.Why
Rspack's resolver pipeline and
RSDoctor's loader intercept expect the value of eachresolveLoader.fallbackentry to be an array. A bare string passes the TS types (which allowstring | string[]) but trips Rspack's NAPI binding when downstream consumers try to use it.Test plan
pnpm typecheckpasses for all 11 packagespnpm lint:cipassespnpm testinpackages/repackpasses 314 tests (added 2 new tests forBabelPlugin)RSDoctorworks in a fresh Rspack projectCloses #1455