nx icon indicating copy to clipboard operation
nx copied to clipboard

Module Federation not working without barrel imports?

Open aswarcewicz opened this issue 1 year ago • 0 comments

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
  • [X] 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

aswarcewicz avatar Jun 29 '24 15:06 aswarcewicz