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

Fresh react app with rspack doesn't work #28464

Closed
4 tasks
Wykks opened this issue Oct 16, 2024 · 0 comments · Fixed by #28515
Closed
4 tasks

Fresh react app with rspack doesn't work #28464

Wykks opened this issue Oct 16, 2024 · 0 comments · Fixed by #28515
Assignees
Labels
scope: bundlers Issues related to webpack, rollup type: bug

Comments

@Wykks
Copy link

Wykks commented Oct 16, 2024

Current Behavior

When I create a brand new app in a brand new workspace, I get this error

npx nx serve my-app --verbose

 NX   Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it. See errors below.

Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it.
      An error occurred while processing files for the @nx/rspack/plugin plugin.
    - my-app/rspack.config.js: Cannot read properties of null (reading 'nodes')
      TypeError: Cannot read properties of null (reading 'nodes')
          at makeConfig ([redated]/test/node_modules/@nx/rspack/src/utils/with-nx.js:16:46)

Expected Behavior

nx serve should work out of the box

GitHub Repo

No response

Steps to Reproduce

  1. npx create-nx-workspace --preset=apps
  2. npx nx add @nx/rspack (edit: it looks like, it works fine if you skip this step)
  3. npx nx add @nx/react
  4. npx nx g @nx/react:app my-app --bundler=rspack
  5. npx nx serve my-app --verbose

Nx Report

NX Report complete - copy this into the issue template

Node : 20.14.0
OS : linux-x64
Native Target : x86_64-linux
npm : 10.7.0

nx : 20.0.1
@nx/js : 20.0.1
@nx/eslint : 20.0.1
@nx/workspace : 20.0.1
@nx/devkit : 20.0.1
@nx/eslint-plugin : 20.0.1
@nx/react : 20.0.1
@nx/rspack : 20.0.1
@nx/vite : 20.0.1
@nx/web : 20.0.1
typescript : 5.5.4

Registered Plugins:
@nx/rspack/plugin
@nx/vite/plugin
@nx/eslint/plugin

⚠️ Unable to construct project graph.
Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it.
Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it.
An error occurred while processing files for the @nx/rspack/plugin plugin.
- my-app/rspack.config.js: Cannot read properties of null (reading 'nodes')
TypeError: Cannot read properties of null (reading 'nodes')

Failure Logs

No response

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

It looks like it works fine if I skip npx nx add @nx/rspack, and let the command npx nx g @nx/react:app my-app --bundler=rspack auto add rspack

@Wykks Wykks changed the title Fresh react rspack doesn't work Fresh react app with rspack doesn't work Oct 16, 2024
@Coly010 Coly010 self-assigned this Oct 16, 2024
@Coly010 Coly010 added the scope: bundlers Issues related to webpack, rollup label Oct 16, 2024
jaysoo pushed a commit that referenced this issue Oct 18, 2024
…gin #28464 (#28515)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
When you create a react rspack app when there is a `@nx/rspack/plugin`
definition in the nx.json, it causes the project graph to fail to create
nodes.


## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Ensure the projects created via @nx/react:app --bundler=rspack are added
to exclude array if the plugin exists

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #28464
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: bundlers Issues related to webpack, rollup type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants