-
-
Notifications
You must be signed in to change notification settings - Fork 69
"Unable to resolve path to module" in monorepo, after Angular 13 upgrade #188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
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. |
Hi @JounQin - I've created a repro monorepo app: https://github.com/scott-ut/eslint-import-resolver-typescript-repro There are instructions in the readme. I think Angular 13 might have been a red herring as the APF removes certain default fields inside the /dist/package.json file which Maybe a clean solution would be to look for |
Hi @JounQin - did you get a chance to look at this? |
Sorry I'm on a vocation recently, I'll take a look when I'm free. |
@scott-ut I think you should use: "paths": {
"@foo/bar": [
- "../../node_modules/@foo/bar/dist/baz"
+ "../bar/projects/baz/src/public-api.ts"
]
} So that the But the PR's change seems correct to me at the same time. |
Thanks - we want to use the built, |
close via #187 |
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 directorynode_modules/@foo/bar/dist
, which contains a package.json file, a type definition file calledfoo-bar.d.ts
and folders for built assets. The package.json file in the built assets contains atypings
entry, that referencesfoo-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, andenhanced-resolve
correctly resolves the module and its types as it parses thetypings
key inside package.json.See #187 for a suggested fix
The text was updated successfully, but these errors were encountered: