* in lhs of tsconfig paths don't get processed correctly
See original GitHub issueI love the idea of this project and have some ideas for further contributions!
But I can’t seem to make it work. I’m not sure why, but NONE of my dependencies are found, specifically every import
hits the included not-to-unresolvable
rule. My project is 100% typescript.
It fails for:
- modules in node_modules
- local, relative dependencies
- inter-module dependencies (like
uf/foo/bar
importsuf/base/xhr
,
All of these should be resolvable using the paths
settings in tsconfig.json
Expected Behavior
I expect it to find these dependencies.
Current Behavior
All imports are marked invalid: code like this:
import superagent from 'superagent';
import Swagger from 'swagger-client';
import { UFApiClient } from 'uf-api';
import { UFApiClient as UFManagementApiClient } from 'uf-api-management';
import warning from 'warning';
results in errors like this:
error not-to-unresolvable: uf/base/xhr.ts → superagent
error not-to-unresolvable: uf/base/xhr.ts → swagger-client
error not-to-unresolvable: uf/base/xhr.ts → uf-api
error not-to-unresolvable: uf/base/xhr.ts → uf-api-management
error not-to-unresolvable: uf/base/xhr.ts → warning
Possible Solution
No idea!
Steps to Reproduce (for bugs)
Our project is quite large, our setup is as follows:
package.json
has"name": "uf"
- source code is in the directory
uf
- There are other directories here:
uf-api
anduf-api-management
- I realize these should be separate packages but they aren’t right now. - tsconfig has paths:
"paths": {
"*": ["types/*"],
"integration/*": ["integration/*"],
"uf-api-management": ["uf-api-management"],
"uf-api-management/*": ["uf-api-management/*"],
"uf-api": ["uf-api"],
"uf-api/*": ["uf-api/*"],
"uf/*": ["uf/*"]
},
Context
Just trying it by installing globally, and also installing directly into the project.
Your Environment
- Version used: 4.13.1
- Node version: 10.15.1
- Operating System and version: OSX
- Link to your project: (not open source)
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Why are these tsconfig paths not working? - Stack Overflow
In case anyone is using VSCode and having trouble getting the /* solution to work. Try Cmd+Shift+P > Typescript: Restart TS Server. –...
Read more >Typescript — How to solve the problem with unresolved path ...
The actual cause of the issue is that the tsc compiler does not transpiles correctly the path aliases to absolute (real) paths.
Read more >TSConfig Reference - Docs on every TSConfig option
All relative paths found in the configuration file will be resolved relative to the configuration file ... If noResolve is set, this process...
Read more >Vite Tsconfig Paths: Support for TypeScript's Path Mapping In ...
In this library, learn about Vite Tsconfig Paths: Support for TypeScript's Path Mapping In Vite. Give vite the ability to resolve imports using...
Read more >Typescript – How to solve the problem with unresolved path ...
js file containing the line with the path alias. The actual cause of the issue is that the tsc compiler does not transpiles...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
trying it out now! …and, it worked perfectly, thanks!
(the reason for the seemingly duplicate entries was issues importing from both
'uf-api'
as well as'uf-api/foo/bar'
- I might be able to remove them…)@alecf version 4.13.2 that includes the fix for this issue is on npm since a few minutes. Thanks again for raising the issue and your detailed & complete reports - it definitely helped speed up fixing this issue!