question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

* in lhs of tsconfig paths don't get processed correctly

See original GitHub issue

I 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:

  1. modules in node_modules
  2. local, relative dependencies
  3. inter-module dependencies (like uf/foo/bar imports uf/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:

  1. package.json has "name": "uf"
  2. source code is in the directory uf
  3. There are other directories here: uf-api and uf-api-management - I realize these should be separate packages but they aren’t right now.
  4. 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:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
alecfcommented, Feb 20, 2019

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…)

0reactions
sverweijcommented, Feb 20, 2019

@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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found