nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.28k stars 2.32k forks source link

With version 19.7.4, following the tutorial (dynamic module federation with angular), Nx build fails for remote mf #27982

Closed isunilmekala closed 2 days ago

isunilmekala commented 2 days ago

Current Behavior

With version 19.7.2, following the tutorial, mf startup works fine but build fails

image

Expected Behavior

Build should complete without errors.

GitHub Repo

No response

Steps to Reproduce

  1. following the tutorial
  2. After remote MF creation, run nx run-many --targets=build

Nx Report

PS C:\Workspaces\temp\ng-mf-temp> nx report

 NX   Report complete - copy this into the issue template

Node           : 22.3.0
OS             : win32-x64
Native Target  : x86_64-windows
npm            : 10.8.3

nx (global)        : 19.7.4
nx                 : 19.7.4
@nx/js             : 19.7.4
@nx/jest           : 19.7.4
@nx/linter         : 19.7.4
@nx/eslint         : 19.7.4
@nx/workspace      : 19.7.4
@nx/angular        : 19.7.4
@nx/devkit         : 19.7.4
@nx/eslint-plugin  : 19.7.4
@nrwl/tao          : 19.7.4
@nx/web            : 19.7.4
@nx/webpack        : 19.7.4
typescript         : 5.5.4

Failure Logs

PS C:\Workspaces\temp\ng-mf-temp> nx run-many --targets=build --verbose

 NX   Running target build for 3 projects:

- ng-mf-temp
- dashboard
- login

———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

> nx run ng-mf-temp:build:production  [existing outputs match the cache, left as is]

- Generating browser application bundles (phase: setup)...
✔ Browser application bundle generation complete.
✔ Browser application bundle generation complete.
- Copying assets...
✔ Copying assets complete.
- Generating index html...
✔ Index html generation complete.

Initial chunk files           | Names         |  Raw size | Estimated transfer size
main.d7df5450537d8c50.js      | main          | 215.52 kB |                56.45 kB
polyfills.36b15c6a7756ce49.js | polyfills     |  34.81 kB |                11.32 kB
runtime.7bee023a489c968b.js   | runtime       | 898 bytes |               517 bytes
styles.ef46db3751d8e999.css   | styles        |   0 bytes |                       -

                              | Initial total | 251.23 kB |                68.30 kB

Build at: 2024-09-18T21:01:38.943Z - Hash: 9f7c6df1b295a085 - Time: 37749ms

> nx run login:build:production

- Generating browser application bundles (phase: setup)...
    TypeScript compiler options "target" and "useDefineForClassFields" are set to "ES2022" and "false" respectively by the Angular CLI. To control ECMA version and features use the Browserslist configuration. For more information, see https://angular.dev/tools/cli/build#configuring-browser-compatibility
    NOTE: You can set the "target" to "ES2022" in the project's tsconfig to remove this warning.
(node:10076) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
[ Module Federation Manifest Plugin ]: Manifest will use absolute path resolution via its host at runtime, reason: publicPath='auto'
    [webpack.cache.PackFileCacheStrategy] No pack exists at C:\Workspaces\temp\ng-mf-temp\.angular\cache\18.2.4\angular-webpack\c7b0163b7e6a72462123d9178415dbcba587b466.pack: Error: ENOENT: no such file or directory, stat 'C:\Workspaces\temp\ng-mf-temp\.angular\cache\18.2.4\angular-webpack\c7b0163b7e6a72462123d9178415dbcba587b466\index.pack'
<t> [webpack.cache.PackFileCacheStrategy] restore cache container: 29.9934 ms
    [IdleFileCachePlugin] Initial cache was generated and cache will be persisted in 5s.
✔ Browser application bundle generation complete.

 NX   ENOENT: no such file or directory, scandir ''

HookWebpackError: ENOENT: no such file or directory, scandir ''
    at makeWebpackError (C:\Workspaces\temp\ng-mf-temp\node_modules\webpack\lib\HookWebpackError.js:48:9)
    at C:\Workspaces\temp\ng-mf-temp\node_modules\webpack\lib\Compilation.js:3204:12
    at eval (eval at create (C:\Workspaces\temp\ng-mf-temp\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:31:1)
    at fn (C:\Workspaces\temp\ng-mf-temp\node_modules\webpack\lib\Compilation.js:493:17)
    at _next6 (eval at create (C:\Workspaces\temp\ng-mf-temp\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:28:1)
    at eval (eval at create (C:\Workspaces\temp\ng-mf-temp\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:46:1)
    at fn (C:\Workspaces\temp\ng-mf-temp\node_modules\webpack\lib\Compilation.js:505:9)
    at _next5 (eval at create (C:\Workspaces\temp\ng-mf-temp\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:41:1)
    at eval (eval at create (C:\Workspaces\temp\ng-mf-temp\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:60:1)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
-- inner error --
Error: ENOENT: no such file or directory, scandir ''
    at Object.readdirSync (node:fs:1509:26)
    at CacheBackend.provideSync (C:\Workspaces\temp\ng-mf-temp\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:332:58)
    at WebpackFileSystem.listPaths (C:\Workspaces\temp\ng-mf-temp\node_modules\license-webpack-plugin\dist\WebpackFileSystem.js:78:24)
    at LicenseTextReader.readLicense (C:\Workspaces\temp\ng-mf-temp\node_modules\license-webpack-plugin\dist\LicenseTextReader.js:37:54)
    at PluginChunkReadHandler.processModule (C:\Workspaces\temp\ng-mf-temp\node_modules\license-webpack-plugin\dist\PluginChunkReadHandler.js:71:62)
    at C:\Workspaces\temp\ng-mf-temp\node_modules\license-webpack-plugin\dist\PluginChunkReadHandler.js:24:27
    at WebpackInnerModuleIterator.internalCallback (C:\Workspaces\temp\ng-mf-temp\node_modules\license-webpack-plugin\dist\WebpackInnerModuleIterator.js:39:13)
    at WebpackInnerModuleIterator.iterateModules (C:\Workspaces\temp\ng-mf-temp\node_modules\license-webpack-plugin\dist\WebpackInnerModuleIterator.js:21:9)
    at C:\Workspaces\temp\ng-mf-temp\node_modules\license-webpack-plugin\dist\PluginChunkReadHandler.js:20:39
    at WebpackChunkModuleIterator.iterateModules (C:\Workspaces\temp\ng-mf-temp\node_modules\license-webpack-plugin\dist\WebpackChunkModuleIterator.js:42:21)
    at PluginChunkReadHandler.processChunk (C:\Workspaces\temp\ng-mf-temp\node_modules\license-webpack-plugin\dist\PluginChunkReadHandler.js:19:29)
    at _loop_1 (C:\Workspaces\temp\ng-mf-temp\node_modules\license-webpack-plugin\dist\WebpackCompilerHandler.js:135:37)
    at WebpackCompilerHandler.iterateChunks (C:\Workspaces\temp\ng-mf-temp\node_modules\license-webpack-plugin\dist\WebpackCompilerHandler.js:160:17)
    at C:\Workspaces\temp\ng-mf-temp\node_modules\license-webpack-plugin\dist\WebpackCompilerHandler.js:50:31
    at fn (C:\Workspaces\temp\ng-mf-temp\node_modules\webpack\lib\Compilation.js:491:10)
    at _next6 (eval at create (C:\Workspaces\temp\ng-mf-temp\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:28:1)
    at eval (eval at create (C:\Workspaces\temp\ng-mf-temp\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:46:1)
    at fn (C:\Workspaces\temp\ng-mf-temp\node_modules\webpack\lib\Compilation.js:505:9)
    at _next5 (eval at create (C:\Workspaces\temp\ng-mf-temp\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:41:1)
    at eval (eval at create (C:\Workspaces\temp\ng-mf-temp\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:60:1)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 NX   Running target build for 3 projects failed

Tasks not run because their dependencies failed or --nx-bail=true:

- dashboard:build:production

Failed tasks:

- login:build:production

Package Manager Version

No response

Operating System

Additional Information

No response

Coly010 commented 2 days ago

I cannot reproduce this on macOS, making this seem more likely to be a windows issue.

The only other variable is the Node version. I can see you're using Node v22. Out of curiosity, could you try it with Node v20?

Node           : 20.12.2
OS             : darwin-arm64
Native Target  : aarch64-macos
npm            : 10.5.0

nx                 : 19.7.4
@nx/js             : 19.7.4
@nx/jest           : 19.7.4
@nx/linter         : 19.7.4
@nx/eslint         : 19.7.4
@nx/workspace      : 19.7.4
@nx/angular        : 19.7.4
@nx/devkit         : 19.7.4
@nx/eslint-plugin  : 19.7.4
@nrwl/tao          : 19.7.4
@nx/web            : 19.7.4
@nx/webpack        : 19.7.4
typescript         : 5.5.4
Coly010 commented 2 days ago

Closing this as a duplicate of: https://github.com/nrwl/nx/issues/27989

We'll keep these issues to one GH Issue thread