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

[@nx/rspack/plugin] ...rspack.config.js: TypeError: Cannot read properties of undefined (reading 'output') #30011

Open
1 of 4 tasks
ryok90 opened this issue Feb 12, 2025 · 0 comments · May be fixed by #30012
Open
1 of 4 tasks

Comments

@ryok90
Copy link

ryok90 commented Feb 12, 2025

Current Behavior

When using @nx/rspack/plugin coupled with an Rspack/React application, Nx is unable to resolve the rspack configuration from rspack.config.js.

Image

The issue was introduced in this commit and the fix should be a reflection of what was made for the webpack version, return the configuration.

Image

Expected Behavior

Rspack configuration should resolve normally.

GitHub Repo

https://github.com/ryok90/nx-rspack-react-bug

Steps to Reproduce

From reproduced repo:

  1. pnpm i

  2. npx nx run react-app:build --skip-nx-cache

From scratch:

  1. run npx create-nx-workspace:

Image

  1. Add configuration for @nx/rspack/plugin to nx.json in plugins:
{
  "plugin": "@nx/rspack/plugin",
  "options": {
    "buildTargetName": "build",
    "serveTargetName": "serve",
    "previewTargetName": "preview",
    "buildDepsTargetName": "build-deps",
    "watchDepsTargetName": "watch-deps"
  }
}
  1. Run the created rspack react app;

Nx Report

Node           : 22.13.0
OS             : darwin-arm64
Native Target  : aarch64-macos
pnpm           : 9.15.5

nx                     : 20.4.2
@nx/js                 : 20.4.2
@nx/jest               : 20.4.2
@nx/eslint             : 20.4.2
@nx/workspace          : 20.4.2
@nx/devkit             : 20.4.2
@nx/eslint-plugin      : 20.4.2
@nx/module-federation  : 20.4.2
@nx/react              : 20.4.2
@nx/rspack             : 20.4.2
@nx/web                : 20.4.2
typescript             : 5.7.3
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/jest/plugin
@nx/rspack/plugin
---------------------------------------
⚠️ Unable to construct project graph.
Failed to process project graph.
     - apps/react-app/rspack.config.js: TypeError: Cannot read properties of undefined (reading 'output')
      at createRspackTargets (/Users/ryok90/valor/nx-rspack-react-bug/node_modules/.pnpm/@nx+rspack@20.4.2_@babel+traverse@7.26.8_@module-federation+enhanced@0.8.11_@rspack+core@1.2._uw5nh7z4gukjolcyjqozpid5wu/node_modules/@nx/rspack/src/plugins/plugin.js:85:20)
      at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
      at async createNodesInternal (/Users/ryok90/valor/nx-rspack-react-bug/node_modules/.pnpm/@nx+rspack@20.4.2_@babel+traverse@7.26.8_@module-federation+enhanced@0.8.11_@rspack+core@1.2._uw5nh7z4gukjolcyjqozpid5wu/node_modules/@nx/rspack/src/plugins/plugin.js:66:28)
      at async /Users/ryok90/valor/nx-rspack-react-bug/node_modules/.pnpm/nx@20.4.2_@swc-node+register@1.9.2_@swc+core@1.5.29_@swc+helpers@0.5.15__@swc+types@0.1.17_ty_dd5iqw5e6wfkobbzcxuzvtsryu/node_modules/nx/src/project-graph/plugins/utils.js:11:27
      at async Promise.all (index 0)
      at async createNodesFromFiles (/Users/ryok90/valor/nx-rspack-react-bug/node_modules/.pnpm/nx@20.4.2_@swc-node+register@1.9.2_@swc+core@1.5.29_@swc+helpers@0.5.15__@swc+types@0.1.17_ty_dd5iqw5e6wfkobbzcxuzvtsryu/node_modules/nx/src/project-graph/plugins/utils.js:9:5)
      at async exports.createNodesV2 (/Users/ryok90/valor/nx-rspack-react-bug/node_modules/.pnpm/@nx+rspack@20.4.2_@babel+traverse@7.26.8_@module-federation+enhanced@0.8.11_@rspack+core@1.2._uw5nh7z4gukjolcyjqozpid5wu/node_modules/@nx/rspack/src/plugins/plugin.js:35:20)
      at async LoadedNxPlugin.createNodes (/Users/ryok90/valor/nx-rspack-react-bug/node_modules/.pnpm/nx@20.4.2_@swc-node+register@1.9.2_@swc+core@1.5.29_@swc+helpers@0.5.15__@swc+types@0.1.17_ty_dd5iqw5e6wfkobbzcxuzvtsryu/node_modules/nx/src/project-graph/plugins/loaded-nx-plugin.js:26:36)
      at async LoadedNxPlugin.createNodes.<computed> (/Users/ryok90/valor/nx-rspack-react-bug/node_modules/.pnpm/nx@20.4.2_@swc-node+register@1.9.2_@swc+core@1.5.29_@swc+helpers@0.5.15__@swc+types@0.1.17_ty_dd5iqw5e6wfkobbzcxuzvtsryu/node_modules/nx/src/project-graph/plugins/loaded-nx-plugin.js:36:28)
      at async createNodes (/Users/ryok90/valor/nx-rspack-react-bug/node_modules/.pnpm/nx@20.4.2_@swc-node+register@1.9.2_@swc+core@1.5.29_@swc+helpers@0.5.15__@swc+types@0.1.17_ty_dd5iqw5e6wfkobbzcxuzvtsryu/node_modules/nx/src/project-graph/plugins/isolation/plugin-worker.js:72:36)
      TypeError: Cannot read properties of undefined (reading 'output')
          at createRspackTargets (/Users/ryok90/valor/nx-rspack-react-bug/node_modules/.pnpm/@nx+rspack@20.4.2_@babel+traverse@7.26.8_@module-federation+enhanced@0.8.11_@rspack+core@1.2._uw5nh7z4gukjolcyjqozpid5wu/node_modules/@nx/rspack/src/plugins/plugin.js:85:20)
          at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
          at async createNodesInternal (/Users/ryok90/valor/nx-rspack-react-bug/node_modules/.pnpm/@nx+rspack@20.4.2_@babel+traverse@7.26.8_@module-federation+enhanced@0.8.11_@rspack+core@1.2._uw5nh7z4gukjolcyjqozpid5wu/node_modules/@nx/rspack/src/plugins/plugin.js:66:28)
          at async /Users/ryok90/valor/nx-rspack-react-bug/node_modules/.pnpm/nx@20.4.2_@swc-node+register@1.9.2_@swc+core@1.5.29_@swc+helpers@0.5.15__@swc+types@0.1.17_ty_dd5iqw5e6wfkobbzcxuzvtsryu/node_modules/nx/src/project-graph/plugins/utils.js:11:27
          at async Promise.all (index 0)
          at async createNodesFromFiles (/Users/ryok90/valor/nx-rspack-react-bug/node_modules/.pnpm/nx@20.4.2_@swc-node+register@1.9.2_@swc+core@1.5.29_@swc+helpers@0.5.15__@swc+types@0.1.17_ty_dd5iqw5e6wfkobbzcxuzvtsryu/node_modules/nx/src/project-graph/plugins/utils.js:9:5)
          at async exports.createNodesV2 (/Users/ryok90/valor/nx-rspack-react-bug/node_modules/.pnpm/@nx+rspack@20.4.2_@babel+traverse@7.26.8_@module-federation+enhanced@0.8.11_@rspack+core@1.2._uw5nh7z4gukjolcyjqozpid5wu/node_modules/@nx/rspack/src/plugins/plugin.js:35:20)
          at async LoadedNxPlugin.createNodes (/Users/ryok90/valor/nx-rspack-react-bug/node_modules/.pnpm/nx@20.4.2_@swc-node+register@1.9.2_@swc+core@1.5.29_@swc+helpers@0.5.15__@swc+types@0.1.17_ty_dd5iqw5e6wfkobbzcxuzvtsryu/node_modules/nx/src/project-graph/plugins/loaded-nx-plugin.js:26:36)
          at async LoadedNxPlugin.createNodes.<computed> (/Users/ryok90/valor/nx-rspack-react-bug/node_modules/.pnpm/nx@20.4.2_@swc-node+register@1.9.2_@swc+core@1.5.29_@swc+helpers@0.5.15__@swc+types@0.1.17_ty_dd5iqw5e6wfkobbzcxuzvtsryu/node_modules/nx/src/project-graph/plugins/loaded-nx-plugin.js:36:28)
          at async createNodes (/Users/ryok90/valor/nx-rspack-react-bug/node_modules/.pnpm/nx@20.4.2_@swc-node+register@1.9.2_@swc+core@1.5.29_@swc+helpers@0.5.15__@swc+types@0.1.17_ty_dd5iqw5e6wfkobbzcxuzvtsryu/node_modules/nx/src/project-graph/plugins/isolation/plugin-worker.js:72:36)

Failure Logs

Package Manager Version

pnpm -v # 9.15.5

Operating System

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

Additional Information

No response

ryok90 added a commit to ryok90/nx that referenced this issue Feb 12, 2025
WHen using @nx/rspack/plugin coupled with an rspack application, nx graph fails to resolve the
rspack config.
This happens because a return is missing when nxRspackComposablePlugin is enabled.

closed nrwl#30011
ryok90 added a commit to ryok90/nx that referenced this issue Feb 12, 2025
WHen using @nx/rspack/plugin coupled with an rspack application, nx graph fails to resolve the
rspack config.
This happens because a return is missing when nxRspackComposablePlugin is enabled.

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

Successfully merging a pull request may close this issue.

1 participant