I got applicatin and library both updated to Angular 16.
In application I use to have imports like
import {modulex} from my-lib/modulex
After update I get error that module cannot be found
I have to change path to
import {modulex} from my-lib
And all works fine then but Im wondering why
Additionaly – previously my-lib has fesm2015 and 2020 in dist after build , now it has only fesm2022 – does it matter ?
The path to your dependencies are driven by the files in which they are exported.
For example
If you create a logger function inside a library called lib and export it from its source class like below
//filename - logger.ts
export function logger(){}
To consume logger in your application, you would have to import it like below
import {logger} 'lib/logger';
If in addition to the above structure, you create a file called public-api.ts and set it as the entry point of your library in the package.json and its content is as follows
//filename - public-api.ts
export * from 'logger';
Then to consume logger, you will have to import it as follows
import {logger} 'lib';
Now, given the above structure, you should still be able to import the logger function like this import {logger} 'lib/logger';
If you are getting that error, you need to confirm that logger is exported in its source file.
Note that public-api.ts is the default file that exports all dependencies for external consumption by default in Angular libraries.