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.

Imports breaking on >1.4.0

See original GitHub issue

I’m upgrading the dependencies on my projects, and after upgrading tsc-alias (to 1.4.1 or 1.5.0), some of my imports are breaking.

The paths on my tsconfig is like this:

"paths": {
      "~/*": ["./*"]
    },

But this

import { Dispatch } from 'redux';

Is becoming

import { Dispatch } from '../../redux';

I think it’s because there is a redux folder on the folder it’s compiling, but it should not be parsed, as it does not begins with ~/


Another problem I had, was because some paths were not being parsed if an asset was not present (on the release script they were added afterwards)

This import was not parsed if the svg file was not present in the dist folder

export { default as iconx } from '~/assets/icons/iconx.svg';

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
raouldeheercommented, Mar 14, 2022

@ThiagoNP

I think it’s because there is a redux folder on the folder it’s compiling, but it should not be parsed, as it does not begins with ~/

This is probably because it’s resolving to the baseUrl. This could be solved by add a small config to tsconfig.json. More info on this is in issue #71

{
  "compilerOptions": {
    ...
  },
  "tsc-alias": {
    "replacers": {
      "base-url": {
        "enabled": false
      }
    }
  }
}

The second problem happens because tsc-alias checks if the file exists, because if it doesn’t it will use the next path in the array (in the tsconfig each path has an array of solutions). But this problem can be easily fixed by added dummy files so that the file exists and resolves.

1reaction
raouldeheercommented, Jul 19, 2022

@justkey007 Maybe we should add a link to the F.A.Q. #110 in the readme?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Import broken by sqlalchemy 1.4.0 · Issue #505 - GitHub
1.4 left beta yesterday, so I think this is more urgent now than it was. All reactions.
Read more >
findimports - PyPI
Python module import analysis tool. ... 1.4.0 (2015-06-04) ... Fixed broken and uninstallable source distribution by adding a MANIFEST.in.
Read more >
Traps for the Unwary in Python's Import System
Python's import system is powerful, but also quite complicated. ... due to broken imports (either failing to find example for absolute imports like...
Read more >
cannot import name '_ColumnEntity' from 'sqlalchemy.orm ...
I just pip installed apache-superset fresh. it complained with "flask-appbuilder 3.2.2 requires SQLAlchemy<1.4.0, but you'll have sqlalchemy 1.4 ...
Read more >
Go 1.4 Release Notes - The Go Programming Language
Import paths for the subrepositories: The go generate subcommand: Change to file ... and a possibly breaking change to the compiler involving methods...
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