-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Copy link
Labels
outdatedpriority: mediumMedium Priority (not high, not low priority)Medium Priority (not high, not low priority)scope: module federationIssues related to module federation supportIssues related to module federation supporttype: bug
Description
Current Behavior
The official nx documentation mentions to use @monodun/rust package for building cargo packages.
This nx plugin adds externalNodes "cargo:".
These externals are not supported by the @nx/module-federation plugin. Especially the "getDependencies" method threats the cargo externals as workspace packages and crashes at
| root: projectGraph.nodes[dependency.target].data.root, |
This issue is related to Cammisuli/monodon#73 but I think the @nx/module-federation should get a fix
Expected Behavior
@nx/module-federation works with at least cargo and npm packages
- A further optimization would be a configurable behaviour of the
getDependenciesmethod. - Or to allow plugins (like
@monodun/rust) to extend workspace wide configuration (e.g. externalsPrefixes) - Or to dynamically extract the externals prefixes from the list of nodes
GitHub Repo
No response
Steps to Reproduce
- Walk through
https://nx.dev/showcase/example-repos/add-rust(the cats library is sufficient) - Update the library name in
Cargo.tomltolibs_cats_cats npm i @nx/module-federation @nx/devkit- Create and run the file
repro.js; content:
const { getDependentPackagesForProject } = require("@nx/module-federation");
const { readCachedProjectGraph } = require("@nx/devkit");
const projectGraph = readCachedProjectGraph();
getDependentPackagesForProject(projectGraph, "libs_cats_cats");Nx Report
Node : 22.17.0
OS : win32-x64
Native Target : x86_64-windows
npm : 10.9.2
nx : 21.5.3
@nx/js : 21.5.3
@nx/workspace : 21.5.3
@nx/devkit : 21.5.3
@nx/module-federation : 21.5.3
@nx/web : 21.5.3
typescript : 5.9.2
---------------------------------------
Registered Plugins:
@monodon/rust
---------------------------------------
Community plugins:
@monodon/rust : 2.3.0
---------------------------------------
Cache Usage: 0.00 B / 95.21 GBFailure Logs
> node .\repro.js
acme\node_modules\@nx\module-federation\src\utils\dependencies.js:29
root: projectGraph.nodes[dependency.target].data.root,
^
TypeError: Cannot read properties of undefined (reading 'data')
at acme\node_modules\@nx\module-federation\src\utils\dependencies.js:29:61
at Array.forEach (<anonymous>)
at collectDependencies (acme\node_modules\@nx\module-federation\src\utils\dependencies.js:22:45)
at getDependentPackagesForProject (acme\node_modules\@nx\module-federation\src\utils\dependencies.js:8:49)
at Object.<anonymous> (acme\repro.js:5:1)
at Module._compile (node:internal/modules/cjs/loader:1730:14)
at Object..js (node:internal/modules/cjs/loader:1895:10)
at Module.load (node:internal/modules/cjs/loader:1465:32)
at Function._load (node:internal/modules/cjs/loader:1282:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
Node.js v22.17.0Package Manager Version
npm 10.9.2
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
outdatedpriority: mediumMedium Priority (not high, not low priority)Medium Priority (not high, not low priority)scope: module federationIssues related to module federation supportIssues related to module federation supporttype: bug