"Unable to resolve path to module" in monorepo, after Angular 13 upgrade
See original GitHub issueAfter 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 https://github.com/import-js/eslint-import-resolver-typescript/pull/187 for a suggested fix
Issue Analytics
- State:
- Created a year ago
- Comments:7 (3 by maintainers)
Top Related StackOverflow Question
Thanks for issue first, can you provide a minimal reproduction with ng-cli maybe first? I’m also using Angular 13+, but didn’t meet this problem. So I need to confirm and understand the root cause first.
close via #187