Conversation
fixes #6914 In #8668 we upgraded from babel to swc through rollup for cjs builds, however the build output was slightly different, notably from: ``` new InstantSearch.default() ``` to ``` new InstantSearch() ``` for an import from instantsearch.js in react-instantsearch-core. This PR fixes that by ensuring interop is correctly set for swc commonjs modules. example diff we fix: https://npmdiff.dev/react-instantsearch-core/7.25.0/7.26.0/package/dist/cjs/lib/useInstantSearchApi.js/
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 671ad53:
|
1 task
There was a problem hiding this comment.
Pull request overview
This PR aims to restore correct CommonJS default-export interop in the Rollup+SWC CJS build output (regression introduced in the Babel→SWC migration), fixing runtime failures such as Expo/Hermes TypeError: constructor is not callable when instantiating instantsearch.js from CJS builds.
Changes:
- Adjust
createCJSConfig()to pass explicit SWC module settings intended to restore CJS interop behavior. - Update
yarn.lock(lockfile entry normalization/removal of unused semver selectors).
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
scripts/build/rollup.base.mjs |
Modifies SWC options for CJS builds to enforce CommonJS interop behavior. |
yarn.lock |
Lockfile entry updates (appears incidental to the build tooling change). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
aymeric-giraudet
approved these changes
Mar 5, 2026
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.
fixes #6914
In #6886 we upgraded from babel to swc through rollup for cjs builds, however the build output was slightly different, notably from:
to
for an import from instantsearch.js in react-instantsearch-core.
This PR fixes that by ensuring interop is correctly set for swc commonjs modules.
example diff we fix: https://npmdiff.dev/react-instantsearch-core/7.25.0/7.26.0/package/dist/cjs/lib/useInstantSearchApi.js/