angular-architects / module-federation-plugin

MIT License
696 stars 189 forks source link

incompatible with pnpm (native federation) #593

Open markusahrweileramcon opened 2 days ago

markusahrweileramcon commented 2 days ago

When i create a fresh workspace with pnpm and i want to run any application, I get the following error:

An unhandled exception occurred: Package subpath './src/builders/application' is not defined by "exports" in \node_modules\.pnpm\node_modules\@angular\build\package.json
jerousseau commented 2 days ago

You need to replace the path in "/node_modules/@angular-architects/native-federation/src/utils/patch-angular-build.js"

-    const packagePath = path.join(workspaceRoot, 'node_modules/@angular/build/package.json');
-    const privatePath = path.join(workspaceRoot, 'node_modules/@angular/build/private.js');
+    const packagePath = path.join(workspaceRoot, 'node_modules/.pnpm/node_modules/@angular/build/package.json');
+    const privatePath = path.join(workspaceRoot, 'node_modules/.pnpm/node_modules/@angular/build/private.js');

and apply the patch : node node_modules/@angular-architects/native-federation/src/patch-angular-build.js