question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Module Federation serving stuck on setup phase

See original GitHub issue

Current Behavior

When using withModuleFederation from @nrwl/angular/module-federation and the code branches into traverseUpFileTreeAndPerformActionUntil, if the library is missing ng-package.json (so every lib that isn’t buildable?) the serving is stuck at Generating browser application bundles (phase: setup)... because it loops endlessy the library folder.

Expected Behavior

The app should be served.

Steps to Reproduce

I’ve migrated the project from Angular 8 to Angular 14. If I expose a newly generated library it works (because the code doesn’t branch into that function), but with our already existing non-publishable libraries it doesn’t, so something went bad down the road. These existing libraries weren’t created with Nx. Help me to find what’s causing this problem.

Environment

   Node : 18.4.0
   OS   : darwin x64
   npm  : 8.12.1
   
   nx : 14.4.2
   @nrwl/angular : 14.4.2
   @nrwl/cypress : 14.4.2
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.4.2
   @nrwl/eslint-plugin-nx : 14.4.2
   @nrwl/express : Not Found
   @nrwl/jest : 14.4.2
   @nrwl/js : 14.4.2
   @nrwl/linter : 14.4.2
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : Not Found
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.4.2
   @nrwl/web : 14.4.2
   @nrwl/workspace : 14.4.2
   typescript : 4.7.4
   ---------------------------------------
   Community plugins:
         @ng-bootstrap/ng-bootstrap: 12.1.2
         ngx-bootstrap: 5.1.1
         rxjs: 6.6.7

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mnltttcommented, Jul 24, 2022

@leosvelperez I just noticed that aliasesUnderLibrary when in tsconfig.base.json I have this:

      "@my-org/shared": [
        "libs/shared/src/index.ts"
      ],
      "@my-org/shared/*": [
        "libs/shared/src/lib/*"
      ],
      "@my-org/shared-somethingelse": [
        "libs/shared-somethingelse/src/index.ts"
      ],

It get’s a different pattern. Every unique-named lib logs this:

[ '@my-org/lib-1/*' ]
[ '@my-org/lib-2/*' ]
[ '@my-org/lib-3/*' ]

But if I have two libs named shared and shared-somethingelse I get this:

[
  '@my-org/shared/*',
  '@my-org/shared-somethingelse',
  '@my-org/shared-somethingelse/*'
]

And it loops.

From this console.log(library, libName, libName.startsWith(library), libName !== library) it logs this:

@my-org/shared @my-org/shared true false @my-org/shared @my-org/shared/* true true @my-org/shared @my-org/shared-somethingelse true → true@my-org/shared @my-org/shared-somethingelse/* true true

That true should be false.

Renaming/removing that let everything work as expected.

0reactions
ubergeoffcommented, Aug 24, 2022

Thx @mnlttt - will give that a try… and confirm later…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module federation - Notes
For our needs, webpack-plugin-serve is perfectly fine in combination with webpack 5. So, as a workaround, install npm 6, install all the packages...
Read more >
Webpack Module Federation handling when the remote app is ...
I just forked a sandbox, tried it with success when the both modules available. It has 2 modules, app1 as the host, and...
Read more >
Troubleshooting guide - Okta Documentation
Use the Access Gateway troubleshooting guide to resolve issues with your organization's Access Gateway deployment.
Read more >
Azure AD Connect Health agent installation - Microsoft Learn
This Azure AD Connect Health article describes agent installation for Active Directory Federation Services (AD FS) and for Sync.
Read more >
How I solved and debugged my Webpack issue through trial ...
But I still decided to give it a shot. npm install webpack-serve --save-dev. I created serve.config.js const serve = require('webpack- ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found