Skip to content

fix(builder): returns empty object instead undefined#370

Merged
fi3ework merged 1 commit intorstackjs:mainfrom
qramilq:fix-react-shims-config-return
Oct 30, 2025
Merged

fix(builder): returns empty object instead undefined#370
fi3ework merged 1 commit intorstackjs:mainfrom
qramilq:fix-react-shims-config-return

Conversation

@qramilq
Copy link
Contributor

@qramilq qramilq commented Oct 29, 2025

The result of function applyReactShims is passing to rsbuildReal.mergeRsbuildConfig which then make destruction when trying normalize config structure. So undefined can't be destructed.

Maybe we should add condition and not pass result of applyReactShims to rsbuildReal.mergeRsbuildConfig if it returns undefined or we need to add conditions in normalizeConfigStructure?

@netlify
Copy link

netlify bot commented Oct 29, 2025

Deploy Preview for storybook-rsbuild ready!

Name Link
🔨 Latest commit 5faa594
🔍 Latest deploy log https://app.netlify.com/projects/storybook-rsbuild/deploys/690219057faa310008f4af3f
😎 Deploy Preview https://deploy-preview-370--storybook-rsbuild.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.

@fi3ework
Copy link
Member

fi3ework commented Oct 29, 2025

thank you for your contributing, i'm not sure whether undefined equals to {} when merging config (i think so, so it's writen like this now). have you ever encounter specific issue with the code changed in this PR? generally, LGTM.

@qramilq
Copy link
Contributor Author

qramilq commented Oct 29, 2025

@fi3ework thank's for reviewing. I passed {}, because it can be destructing without errors:

const configObject = {}
const configUndefined = undefined

const {dev, output} = configObject //  <- Ok
const {dev, output} = configUndefined //  <- Error

How I find this: I installed the rslib and chose to also install the storybook during installation. I didn't change code which was generated by installer. When I try to launch the storybook (using npm run storybook), I get an error:

image

You can try it yourself, just make steps from rslib's guide, just choose react+typescript+storybook

@fi3ework
Copy link
Member

oh. i think it's introduced in web-infra-dev/rsbuild#6369. returning undefined appears to be exploiting a bug to run in the past. an empty object is the correct way. thank you for your contribution.

@fi3ework fi3ework merged commit 2535249 into rstackjs:main Oct 30, 2025
10 checks passed
@qramilq qramilq deleted the fix-react-shims-config-return branch October 30, 2025 22:15
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.

2 participants