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

Allowing NX Project to Use Cypress Component Testing from Webpack when Migrating to RSPack #30235

Open
1 of 4 tasks
Stovana opened this issue Feb 28, 2025 · 0 comments · May be fixed by #30253
Open
1 of 4 tasks

Allowing NX Project to Use Cypress Component Testing from Webpack when Migrating to RSPack #30235

Stovana opened this issue Feb 28, 2025 · 0 comments · May be fixed by #30253

Comments

@Stovana
Copy link

Stovana commented Feb 28, 2025

Current Behavior

When trying to migrate an existing webpack cypress component test to use the rspack executor, it throws an error due to this check

buildableProjectConfig.targets[parsed.target].executor !==
'@nx/webpack:webpack'

However, if the check is disabled (tested via modifying the node_modules directory), the cypress component test runs without issue.

Granted, the nx repo still has a dependency on webpack, but it appears that using rspack as the executor does not cause an issue (and therefore, shouldn't throw an error).

Expected Behavior

For buildTargetWebpack, @nx/webpack:webpack or @nx/rspack:rspack can be used as the executor.

GitHub Repo

No response

Steps to Reproduce

  1. Have an existing webpack react application with cypress component tests
  2. Move application to rspack
  3. Open cypress for the app (for this example, I just used npx cypress open in the app folder in question)

Cypress Configuration Error

Nx Report

Node           : 23.6.1
OS             : darwin-arm64
Native Target  : aarch64-macos
npm            : 10.9.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/cypress            : 20.3.2
@nx/devkit             : 20.3.2
@nx/eslint-plugin      : 20.3.2
@nx/module-federation  : 20.3.2
@nx/react              : 20.3.2
@nx/rspack             : 20.3.2
@nx/web                : 20.3.2
@nx/webpack            : 20.3.2
typescript             : 5.6.3
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/rspack/plugin

Failure Logs

150 |     if (buildableProjectConfig.targets[parsed.target].executor !==
  151 |         '@nx/webpack:webpack') {
> 152 |         throw new InvalidExecutorError(`The '${parsed.target}' target of the '${parsed.project}' project is not using the '@nx/webpack:webpack' executor. ` +
      |               ^
  153 |             `Please make sure to use '@nx/webpack:webpack' executor in that target to use Cypress Component Testing.`);
  154 |     }
  155 |     const context = (0, ct_helpers_1.createExecutorContext)(graph, buildableProjectConfig.targets, parsed.project, parsed.target, parsed.target);
  156 |     const { normalizeOptions, } = require('@nx/webpack/src/executors/webpack/lib/normalize-options');

Package Manager Version

No response

Operating System

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

Additional Information

No response

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