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

Module Federation not working without barrel imports? #26765

Open
1 of 4 tasks
aswarcewicz opened this issue Jun 29, 2024 · 0 comments
Open
1 of 4 tasks

Module Federation not working without barrel imports? #26765

aswarcewicz opened this issue Jun 29, 2024 · 0 comments

Comments

@aswarcewicz
Copy link

Current Behavior

When I removed barrel imports (index.ts) from tsconfig.base.json and replace it by asterisk I got errors Error: Module not found: Error: Can't resolve '@ng-mf/my-button/*' in

Expected Behavior

No errors when compiling without barrel imports

GitHub Repo

https://github.com/aswarcewicz/nx-ng-dyn-fed/blob/no-barrel-imports-tests/tsconfig.base.json

Steps to Reproduce

  1. Clone repository https://github.com/aswarcewicz/nx-ng-dyn-fed
  2. switch to branch no-barrel-imports-tests
  3. run npx nx serve dashboard
  4. In console you get Error: Module not found: Error: Can't resolve '@ng-mf/my-button/*' in '...'

Nx Report

Node   : 20.12.2
OS     : linux-x64
yarn   : 1.22.22

nx (global)        : 18.3.4
nx                 : 18.2.3
@nx/js             : 18.2.3
@nx/jest           : 18.2.3
@nx/linter         : 18.2.3
@nx/eslint         : 18.2.3
@nx/workspace      : 18.2.3
@nx/angular        : 18.2.3
@nx/cypress        : 18.2.3
@nx/devkit         : 18.2.3
@nx/eslint-plugin  : 18.2.3
@nrwl/tao          : 18.2.3
@nx/web            : 18.2.3
@nx/webpack        : 18.2.3
typescript         : 5.4.5
---------------------------------------
Registered Plugins:
@nx/cypress/plugin
@nx/eslint/plugin

Failure Logs

Error: Module not found: Error: Can't resolve '@ng-mf/my-button/*' in '...'

Package Manager Version

No response

Operating System

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

Additional Information

When barrel file is used (index.ts) in tsconfig.base.json like below:
"paths": { ... "@ng-mf/my-button": ["libs/shared/my-button/src/index.ts"],
Everything works as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant