Skip to content

Comments

Force resolving react from node_modules of the app#292

Merged
lkostrowski merged 1 commit intomainfrom
resolve-react-
Feb 3, 2026
Merged

Force resolving react from node_modules of the app#292
lkostrowski merged 1 commit intomainfrom
resolve-react-

Conversation

@lkostrowski
Copy link
Member

This is fix for local development. When pnpm link is used (eg to develop app-sdk), app-sdk is using it's own React, while app is using own.

This config ensures react is always pointing at React in app's node_modules, not linked package

@lkostrowski lkostrowski requested a review from a team as a code owner February 3, 2026 09:18
Comment on lines +6 to +19
webpack: (config) => {
// When using `pnpm link` for local SDK development, webpack may resolve
// react/react-dom from the linked package's node_modules (different version),
// causing the "two Reacts" problem. Force resolution to this project's copy.
config.resolve = {
...config.resolve,
alias: {
...config.resolve?.alias,
react: path.resolve("./node_modules/react"),
"react-dom": path.resolve("./node_modules/react-dom"),
},
};
return config;
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: maybe we should also add this to saleor/apps monorepo as shared config?

@lkostrowski lkostrowski merged commit f17c3d1 into main Feb 3, 2026
7 checks passed
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