Nx vanilla executors#4461
Nx vanilla executors#4461ScriptedAlchemy merged 58 commits intocursor/ci-failures-investigation-b06ffrom
Conversation
- @rspack/core 1.3.9 → 1.7.6 - @rspack/dev-server 1.1.1 → 1.2.1 - @rspack/cli added at 1.7.6 - @rsbuild/core → 2.0.0-beta.4 across all packages and apps (pnpm -r up) - @rsbuild/plugin-react, plugin-vue, plugin-sass updated to latest stable - Added serve package for upcoming file-server migration - Updated peerDependencies in rsbuild-plugin and storybook-addon
- 3010-rspack-provider: standalone rspack.config.js + nx:run-commands - 3011-rspack-manifest-provider: standalone rspack.config.js + nx:run-commands - 3012-rspack-js-entry-provider: standalone rspack.config.js + nx:run-commands - react-ts-remote: standalone rspack.config.js + nx:run-commands, remove webpack targets All configs rewritten to remove composePlugins/withNx/withReact from @nx/rspack. Using @rspack/cli (rspack build / rspack serve) directly.
Build then run via 'node apps/node-host/dist/main.js' instead of the @nx/js:node executor wrapper.
…er with vanilla CLI - storybook target: storybook dev CLI - build-storybook target: storybook build CLI - serve-static target: serve package
… apps Affected apps: - runtime-demo/3005-runtime-host (serve-static) - reactRemoteUI (serve-static) - react-ts-nested-remote (serve-static) - bundle-size (serve-static) - manifest-demo/webpack-host (serve-static) - react-ts-host (serve-static) - docs (serve)
…ack.config.js - @nx/rspack no longer used after rspack CLI migration - @nx/storybook no longer used after storybook CLI migration - react-ts-remote/webpack.config.js removed (redundant, rspack is primary)
Nx requires outputs to use {workspaceRoot} or {projectRoot} interpolation.
All 4 rspack apps and node-host build verified successfully.
|
Cursor Agent can help with this pull request. Just |
|
…apps - @nx/eslint:lint → pnpm exec eslint (23 apps) - @nx/jest:jest → pnpm exec jest (12 apps) - @nx/cypress:cypress → pnpm exec cypress run (15 apps) All app targets now use nx:run-commands exclusively. No Nx-specific executors remain in any app project.json.
Add --no-hot to the webpack-host development serve to prevent lazy-compilation-web.js from throwing HTTP 404 errors during e2e tests.
CLI --no-hot wasn't sufficient. Set hot: false and liveReload: false directly in the webpack devServer config to prevent lazy-compilation runtime from being injected during serve.
…k remotes - webpack-host: add @pmmmwh/react-refresh-webpack-plugin + SWC refresh transform, matching what @nx/react withReact() previously provided - rspack remotes: re-add @rspack/plugin-react-refresh + refresh transform with include/exclude to scope to app src/ only - Re-enable HMR (revert hot:false) across all configs — the proper solution is correct loader scoping, not disabling HMR
…ness Node 22 strictly enforces the vm.Module state machine: - link() transitions status from 'unlinked' to 'linked' - instantiate() requires status 'unlinked' (not 'linked') - evaluate() should not be called on 'evaluated' modules Fix both ConfigTestCases.rstest.ts and helpers/asModule.js to check module status before calling link/instantiate/evaluate, making the test harness compatible with both Node 20 and Node 22.
…or in Cypress Add Cypress uncaught:exception handler to suppress the dev-server 'Problem communicating active modules' HMR error during e2e tests.
The old @nx/rspack:dev-server executor explicitly bound to host '::' (all interfaces). Without this, rspack-dev-server may bind to a specific interface that causes preload/manifest fetches to fail on CI.
…sed lazy-compilation 404 The @pmmmwh/react-refresh-webpack-plugin was injecting HMR runtime code that triggered webpack's lazy-compilation system, causing 'Problem communicating active modules to the server: HTTP 404' errors. The original withReact() only added this plugin when using babel-loader, not swc-loader. Remove it and the refresh transform, revert the uncaught:exception workaround, and restore the original preload test.
… lazy-compilation errors The webpack-dev-server HMR runtime injects lazy-compilation client code that throws 'Problem communicating active modules to the server: HTTP 404' when the lazy-compilation server endpoint is not available. Setting hot:false in the devServer config prevents this HMR runtime from being injected entirely, which is appropriate for MF host apps where HMR can interfere with federation remote loading.
The rspack remotes with hot enabled inject HMR client code into their bundles. When the host loads these remotes, the HMR client runs in the host browser and throws 'Problem communicating active modules to the server: HTTP 404' because the lazy-compilation endpoint is unavailable. Set hot:false and liveReload:false in all rspack remote devServer configs. Also remove ReactRefreshRspackPlugin and refresh transform since they require hot to function.
The webpack provider remote also injects HMR client code that causes 'Problem communicating active modules' errors in the host browser. All MF remotes must have hot:false to prevent this.
The old @nx/webpack dev-server executor defaulted hmr to false. Our webpack-cli/rspack serve commands need --no-hot explicitly to match this behavior, since webpack-cli serve defaults hot to true and can override the config file's hot:false setting.
…ror in Cypress The webpack-dev-server injects HMR runtime modules that throw 'Problem communicating active modules to the server: HTTP 404' even with hot:false and --no-hot. This is a dev-server infrastructure error that the old @nx/webpack executor avoided by starting the server programmatically. Suppress it in Cypress to prevent false test failures.
…ort files Removed the import and the source file at tools/testing/cypress/browser-error-logging.ts
…ng old config
The old withNx()/withReact() config had experiments = { outputModule: false }
which ensures webpack uses traditional script loading instead of ES modules.
This is critical for Module Federation remote loading to work correctly.
…mponent load failure
Add .catch() to import('manifest-provider/Component') to capture
and display the error. Also render error message in DOM so Cypress
can detect it.
The MF Enhanced runtime's manifest loading may require HMR to be enabled for proper initialization. Re-enable hot in the host's devServer while keeping the Cypress uncaught:exception handler for the HMR lazy-compilation errors.
…ng withNx() The old withNx() base config set node:false (disable node polyfills) and experiments.cacheUnaffected:true. These may affect how webpack processes and resolves Module Federation remote modules.
No need for a compiler plugin to patch aliases now that we own the full rspack config directly.
…-b06f' into cursor/nx-vanilla-executors-2928 # Conflicts: # apps/manifest-demo/webpack-host/cypress/e2e/preload.cy.ts # package.json # pnpm-lock.yaml # tools/scripts/run-manifest-e2e.mjs
029d3a4
into
cursor/ci-failures-investigation-b06f
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0a38f83427
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "hmr": true, | ||
| "port": 3005, | ||
| "devRemotes": ["3006-runtime-remote"] | ||
| "command": "NODE_OPTIONS=--max_old_space_size=4096 pnpm exec webpack-cli serve --config apps/runtime-demo/3005-runtime-host/webpack.config.js --mode production --port 3005 --no-hot", |
There was a problem hiding this comment.
Restore remote startup in runtime host serve target
The new serve command only launches the host dev server on port 3005, but this app and its E2E suite still depend on remote1 being available on port 3006 (apps/runtime-demo/3005-runtime-host/src/Root.tsx imports remote1/*, and apps/runtime-demo/3005-runtime-host/cypress/e2e/app.cy.ts asserts content from localhost:3006). Removing devRemotes from this target means nx run 3005-runtime-host:test:e2e now fails in environments where 3006 is not already running, because the host cannot load remote modules.
Useful? React with 👍 / 👎.
Description
This PR migrates remaining applications from Nx-specific executors (e.g.,
@nx/rspack,@nx/js:node,@nx/storybook,@nx/web:file-server) to vanilla command implementations usingnx:run-commands. This simplifies configurations by directly invoking tools likerspack,node,storybook, and theserveCLI.Additionally, the Rspack and Rsbuild ecosystems are upgraded to their latest beta versions. This change reduces reliance on Nx-specific abstractions, providing more direct control over the build process and improving maintainability.
Key changes include:
project.jsonfiles to usenx:run-commandsfor build, serve, and file-serving targets.Related Issue
N/A
Types of changes
Checklist