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 upgrade to 20 migration fails on module-federation-target-defaults #28377

Closed
1 of 4 tasks
armingdev opened this issue Oct 9, 2024 · 6 comments · Fixed by #28382
Closed
1 of 4 tasks

NX upgrade to 20 migration fails on module-federation-target-defaults #28377

armingdev opened this issue Oct 9, 2024 · 6 comments · Fixed by #28382
Assignees
Labels
outdated scope: module federation Issues related to module federation support type: bug

Comments

@armingdev
Copy link
Contributor

Current Behavior

Im trying to upgrade NX monorepo from 19.5.6 to 20.0.0. When I run npx nx migrate latest command runs successfully also as npm i . But when I run npx nx migrate --run-migrations I got error on migration : Running migration @nx/react: update-19-6-1-ensure-module-federation-target-defaults

Inside my NX workspace are three apps : app - NextJS 14.2.3 , admin - React 18.3.1, API - NestJS

Expected Behavior

To upgrade workspace successfully.

GitHub Repo

No response

Steps to Reproduce

  1. inside project dir run: npx nx migrate latest
  2. npm i
  3. npx nx migrate --run-migrations

Nx Report

npx nx report

NX Report complete - copy this into the issue template

Node : 20.11.1
OS : darwin-arm64
Native Target : aarch64-macos
npm : 10.2.4

nx : 20.0.0
@nx/js : 20.0.0
@nx/jest : 20.0.0
@nx/eslint : 20.0.0
@nx/workspace : 20.0.0
@nx/devkit : 20.0.0
@nx/eslint-plugin : 20.0.0
@nx/nest : 20.0.0
@nx/next : 20.0.0
@nx/node : 20.0.0
@nx/playwright : 20.0.0
@nx/react : 20.0.0
@nx/vite : 20.0.0
@nx/web : 20.0.0
@nx/webpack : 20.0.0
typescript : 5.5.4

Failure Logs

npx nx migrate --run-migrations --verbose

NX Running 'npm install' to make sure necessary packages are installed

[email protected] prepare
husky

up to date, audited 3011 packages in 6s

393 packages are looking for funding
run npm fund for details

58 vulnerabilities (3 low, 10 moderate, 45 high)

To address issues that do not require attention, run:
npm audit fix

To address all issues possible (including breaking changes), run:
npm audit fix --force

Some issues need review, and may require choosing
a different dependency.

Run npm audit for details.

NX Running migrations from 'migrations.json'

Running the following migrations:

  • @nx/playwright: 19-6-0-use-serve-static-preview-for-command (Use serve-static or preview for webServerCommand.)
  • @nx/playwright: update-19-6-0-add-e2e-ci-target-defaults (Add inferred ciTargetNames to targetDefaults with dependsOn to ensure dependent application builds are scheduled before atomized tasks.)
  • @nx/react: update-19-6-0-turn-module-federation-dts-off (Ensure Module Federation DTS is turned off by default.)
  • @nx/react: update-module-federation-ssr-server-file (Update the server file for Module Federation SSR port value to be the same as the 'serve' target port value.)
  • @nx/react: update-19-6-1-ensure-module-federation-target-defaults (Ensure Target Defaults are set correctly for Module Federation.)
  • @nx/webpack: update-19-6-3-proxy-config (Migrate proxy config files to match new format from webpack-dev-server v5.)
  • @nx/jest: replace-getJestProjects-with-getJestProjectsAsync (replace getJestProjects with getJestProjectsAsync)
  • nx: move-use-daemon-process (Migration for v20.0.0-beta.7)

Running migration @nx/playwright: 19-6-0-use-serve-static-preview-for-command
Ran 19-6-0-use-serve-static-preview-for-command from @nx/playwright
Use serve-static or preview for webServerCommand.

No changes were made

Running migration @nx/playwright: update-19-6-0-add-e2e-ci-target-defaults
Ran update-19-6-0-add-e2e-ci-target-defaults from @nx/playwright
Add inferred ciTargetNames to targetDefaults with dependsOn to ensure dependent application builds are scheduled before atomized tasks.

No changes were made

Running migration @nx/react: update-19-6-0-turn-module-federation-dts-off
Ran update-19-6-0-turn-module-federation-dts-off from @nx/react
Ensure Module Federation DTS is turned off by default.

No changes were made

Running migration @nx/react: update-module-federation-ssr-server-file
Ran update-module-federation-ssr-server-file from @nx/react
Update the server file for Module Federation SSR port value to be the same as the 'serve' target port value.

No changes were made

Running migration @nx/react: update-19-6-1-ensure-module-federation-target-defaults
Error: ENOENT: no such file or directory, open '/Users/armingerina/Code/someapplication/@nx/react/plugins/webpack'
at Object.openSync (node:fs:581:18)
at readFileSync (node:fs:457:35)
at FsTree.fsReadFile (/Users/armingerina/Code/someapplication/node_modules/nx/src/generators/tree.js:242:43)
at FsTree.read (/Users/armingerina/Code/someapplication/node_modules/nx/src/generators/tree.js:33:32)
at /Users/armingerina/Code/someapplication/node_modules/@nx/react/src/migrations/update-19-6-1/ensure-depends-on-for-mf.js:13:38
at forEachProjectConfig (/Users/armingerina/Code/someapplication/node_modules/@nx/devkit/src/generators/executor-options-utils.js:35:13)
at forEachExecutorOptions (/Users/armingerina/Code/someapplication/node_modules/@nx/devkit/src/generators/executor-options-utils.js:18:5)
at default_1 (/Users/armingerina/Code/someapplication/node_modules/@nx/react/src/migrations/update-19-6-1/ensure-depends-on-for-mf.js:8:57)
at runNxMigration (/Users/armingerina/Code/someapplication/node_modules/nx/src/command-line/migrate/migrate.js:1036:11)
at executeMigrations (/Users/armingerina/Code/someapplication/node_modules/nx/src/command-line/migrate/migrate.js:921:39)

NX Failed to run update-19-6-1-ensure-module-federation-target-defaults from @nx/react. This workspace is NOT up to date!

NX Cannot read properties of null (reading 'includes')

TypeError: Cannot read properties of null (reading 'includes')
at /Users/armingerina/Code/someapplication/node_modules/@nx/react/src/migrations/update-19-6-1/ensure-depends-on-for-mf.js:14:96
at Array.some ()
at /Users/armingerina/Code/someapplication/node_modules/@nx/react/src/migrations/update-19-6-1/ensure-depends-on-for-mf.js:14:68
at forEachProjectConfig (/Users/armingerina/Code/someapplication/node_modules/@nx/devkit/src/generators/executor-options-utils.js:35:13)
at forEachExecutorOptions (/Users/armingerina/Code/someapplication/node_modules/@nx/devkit/src/generators/executor-options-utils.js:18:5)
at default_1 (/Users/armingerina/Code/someapplication/node_modules/@nx/react/src/migrations/update-19-6-1/ensure-depends-on-for-mf.js:8:57)
at runNxMigration (/Users/armingerina/Code/someapplication/node_modules/nx/src/command-line/migrate/migrate.js:1036:11)
at executeMigrations (/Users/armingerina/Code/someapplication/node_modules/nx/src/command-line/migrate/migrate.js:921:39)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runMigrations (/Users/armingerina/Code/someapplication/node_modules/nx/src/command-line/migrate/migrate.js:1009:37)

Command failed: npx nx _migrate --run-migrations --verbose

NX Command failed: npx nx migrate --run-migrations --verbose

Error: Command failed: npx nx migrate --run-migrations --verbose
at checkExecSyncError (node:child_process:890:11)
at execSync (node:child_process:962:15)
at runNxSync (/private/var/folders/zz/6s9z09bj4wj_8zvyv132whv00000gn/T/tmp-44777-IBGZ3vSFo7Hr/node_modules/nx/src/utils/child-process.js:28:34)
at runMigrations (/private/var/folders/zz/6s9z09bj4wj_8zvyv132whv00000gn/T/tmp-44777-IBGZ3vSFo7Hr/node_modules/nx/src/command-line/migrate/migrate.js:984:39)
at /private/var/folders/zz/6s9z09bj4wj_8zvyv132whv00000gn/T/tmp-44777-IBGZ3vSFo7Hr/node_modules/nx/src/command-line/migrate/migrate.js:1050:19
at async handleErrors (/private/var/folders/zz/6s9z09bj4wj_8zvyv132whv00000gn/T/tmp-44777-IBGZ3vSFo7Hr/node_modules/nx/src/utils/handle-errors.js:9:24)

Command failed: /var/folders/zz/6s9z09bj4wj_8zvyv132whv00000gn/T/tmp-44777-IBGZ3vSFo7Hr/node_modules/.bin/nx _migrate --run-migrations --verbose

Package Manager Version

10.2.4

Operating System

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

Additional Information

No response

@armingdev armingdev changed the title NX upgrade to 20 migration module-federation-target-defaults NX upgrade to 20 migration fails on module-federation-target-defaults Oct 9, 2024
@linktogo
Copy link

linktogo commented Oct 9, 2024

same issue for me

@linktogo
Copy link

linktogo commented Oct 9, 2024

@armingdev do you try to update web pack file like this ?
withModuleFederation(moduleFederationConfig, {dts: false})

for me automatic tag was not in the good space.

Now it's working fine

@armingdev
Copy link
Contributor Author

@armingdev do you try to update web pack file like this ? withModuleFederation(moduleFederationConfig, {dts: false})

for me automatic tag was not in the good space.

Now it's working fine

Hi @linktogo , thx for a replay. Do you know if you use NxAppWebpackPlugin? It is not working when I put it in the nxWebpackConfig.

@Coly010
Copy link
Contributor

Coly010 commented Oct 9, 2024

@armingdev My assumption is that you have a project that doesn't use module federation but does have a target in the project.json using @nx/webpack:webpack that has a webpackConfig option pointing to @nx/react/plugins/webpack?

@linktogo
Copy link

linktogo commented Oct 9, 2024

I use
const { withModuleFederation } = require('@nx/angular/module-federation');

jaysoo pushed a commit that referenced this issue Oct 14, 2024
…@nx/react #28377 (#28382)

<!-- 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 -->
Some executors using `@nx/webpack:webpack` point to a webpack config
that is exported from the `@nx/react plugin.

We do not want to try modify this.


## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Skip the migration if the webpack config points to the exported plugin
from @nx/react.


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

Fixes #28377
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2024
Coly010 added a commit to Coly010/nx that referenced this issue Nov 12, 2024
…@nx/react nrwl#28377 (nrwl#28382)

<!-- 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 -->
Some executors using `@nx/webpack:webpack` point to a webpack config
that is exported from the `@nx/react plugin.

We do not want to try modify this.


## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Skip the migration if the webpack config points to the exported plugin
from @nx/react.


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

Fixes nrwl#28377
FrozenPandaz pushed a commit that referenced this issue Nov 12, 2024
…@nx/react #28377 (#28382)

<!-- 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 -->
Some executors using `@nx/webpack:webpack` point to a webpack config
that is exported from the `@nx/react plugin.

We do not want to try modify this.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Skip the migration if the webpack config points to the exported plugin
from @nx/react.

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

Fixes #28377

(cherry picked from commit a18adb7)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: module federation Issues related to module federation support type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants