In my Angular workspace (v10.0.2), I have a library and an app (used for testing the library).
Within the
projects/libname/src/lib/tsconfig.lib.json
file, I have defined some paths:
"baseUrl": "./src",
"paths": {
"@lib/*": ["lib/*"]
}
And I am importing it like this:
import { DateUtils } from '@lib/utils/date.utils';
However, I am receiving a warning:
WARNING: No name was provided for external module '@lib/utils/date.utils' in output.globals – guessing 'date_utils'
It seems that the tsconfig paths are not being replaced, causing ng-packagr
to treat it as an external module. Upon checking the dist
folder, I noticed that '@lib/utils/date.utils' is still present and has not been replaced with the relative path. Ignoring the warning leads to an error when serving the test app:
Cannot find module '@lib/utils/date' or its corresponding type declarations.
I have extensively searched for solutions, but have not found any yet.