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.

Problem with import aliases in tsconfig

See original GitHub issue

Hi,

I apologize if I shouldn’t ask here, but since I didn’t get an answer from Stackoverflow, I thought you might be able to help me:

here is the question I asked on Stackoverflow

In a nutshell, I have set up import aliases in my tsconfig.json, but when I use tsc to compile the code, it’s complaining that it cannot find the modules.

I would really, really appreciate if you could help me

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
farzadmfcommented, Apr 5, 2019

Thank you @jonaskello for all the help; I appreciate it

1reaction
jonaskellocommented, Apr 5, 2019

Unfortunately tsc does not support transforming the imports. You basically have two options:

  1. Use tsconfig-paths with node like this: node -r tsconfig-paths/register out/main.js (see the docs.

  2. Build or find a tool that with transform the imports for you.

Closing since the original issue is sorted.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript — How to solve the problem with unresolved ...
Generally, what should be done can be summarized as follows: Take a look into tsconfig.json and check if there are path aliases defined...
Read more >
Typescript – How to solve the problem with unresolved path ...
The problem. Setting up path aliases in the tsconfig.json file is really a nice approach to making your imports look clear and tidy....
Read more >
Getting import errors on modules using alias in tsconfig
I'm getting intellisense (red squiggles) on my aliased imports, but the project builds OK and runs without error.
Read more >
Can't import files defined as aliases in tsconfig.json under ...
It's because importing what's outside the workspace(where the package.json lies) is really really bad idea. I've tried this but not recommend it ...
Read more >
How to configure and resolve path alias with a Typescript Project
Path alias is a way to define an absolute path in your typescript project ... we will find a more barable import statement,...
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