Some templates seem to generating incorrect rspack config #29673
Description
Current Behavior
Some templates (I have not tested them all) are generating an incorrect rspack.config.js and therefore will not run with the runtime error in the console:
Expected Behavior
If you have not made any changes to the template and try to run it there should be no errors
It currently generates the following rspack.config.js file:
const { composePlugins, withNx, withWeb } = require('@nx/rspack');
module.exports = composePlugins(withNx(), withWeb(), (config) => {
return config;
});
But to get it to work, (I think this this the intended way but please correct me if wrong) the file should be:
const { composePlugins, withNx, withReact } = require('@nx/rspack');
module.exports = composePlugins(withNx(), withReact(), (config) => {
return config;
});
I found this workaround in #29234
GitHub Repo
No response
Steps to Reproduce
- Run npx create-nx-workspace
✔ Where would you like to create your workspace? · test
✔ Which stack do you want to use? · react
✔ What framework would you like to use? · none
✔ Integrated monorepo, or standalone project? · integrated
✔ Application name · test
✔ Which bundler would you like to use? · rspack
✔ Test runner to use for end to end (E2E) tests · playwright
✔ Default stylesheet format · css
✔ Which CI provider would you like to use · Github Actions
-
Try run nx serve test
-
The webpage loads with no content and an error in the browser console
Nx Report
Node : 22.13.0
OS : darwin-arm64
Native Target : aarch64-macos
pnpm : 9.6.0
nx (global) : 20.3.2
nx : 20.3.2
@nx/js : 20.3.2
@nx/jest : 20.3.2
@nx/eslint : 20.3.2
@nx/workspace : 20.3.2
@nx/devkit : 20.3.2
@nx/eslint-plugin : 20.3.2
@nx/playwright : 20.3.2
@nx/react : 20.3.2
@nx/rspack : 20.3.2
typescript : 5.6.3
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/playwright/plugin
@nx/jest/plugin
Failure Logs
index.js:484 [webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.
log.js:39 [HMR] Waiting for update signal from WDS...
react-dom.development.js:29895 Download the React DevTools for a better development experience: https://reactjs.org/link/react-devtools
nx-welcome.tsx:852 Uncaught ReferenceError: $RefreshReg$ is not defined
at ./src/app/nx-welcome.tsx (nx-welcome.tsx:852:26)
at __webpack_require__ (main.tsx:11:9)
at fn (main.tsx:11:9)
at ./src/app/app.tsx (stripAnsi.js:18:25)
at __webpack_require__ (main.tsx:11:9)
at fn (main.tsx:11:9)
at ./src/main.tsx (nx-welcome.tsx:852:26)
at __webpack_require__ (main.tsx:11:9)
at main.tsx:11:9
at main.tsx:11:9
Package Manager Version
No response
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
No response