Description
After upgrading to Angular 13, which only supports Angular Package Format and ESModules, we are seeing "Unable to resolve path to module" issues.
Our code is a monorepo using Yarn Workspaces, with TSConfig path aliases set up to point to the built assets of our library packages, so @foo/bar
is set up to resolve to the directory node_modules/@foo/bar/dist
, which contains a package.json file, a type definition file called foo-bar.d.ts
and folders for built assets. The package.json file in the built assets contains a typings
entry, that references foo-bar.d.ts
.
The issue is that getMappedPath
only looks for files, not directories. If this line is removed, or a check is added for a directory as well as a file, then the mapped path is the folder containing the library, and enhanced-resolve
correctly resolves the module and its types as it parses the typings
key inside package.json.
See #187 for a suggested fix