Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some templates seem to generating incorrect rspack config #29673

Open
1 of 4 tasks
Hoody91 opened this issue Jan 18, 2025 · 1 comment
Open
1 of 4 tasks

Some templates seem to generating incorrect rspack config #29673

Hoody91 opened this issue Jan 18, 2025 · 1 comment

Comments

@Hoody91
Copy link

Hoody91 commented Jan 18, 2025

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:

Image

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

  1. 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

  1. Try run nx serve test

  2. 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

@kiennt23
Copy link

Thanks, I just tried nx with rspack just now and have this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants