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.

Bug: replace module names incorrectly (default import)

See original GitHub issue

Hey

First of all, thanks for this awesome package 😁

We have a small bug.

Steps

  1. Import sharp with:
import sharp from 'sharp';

// ...
  1. Run "tsc && tsc-alias"

Expected

Compiled to JS:

const sharp_1 = __importDefault(require('sharp'));

Actual

Compiled to JS:

const sharp_1 = __importDefault(require('../sharp'));

So there the bug is here! If I remove tsc-alias, I can run the project successfully (via tsconfig-paths for testing)

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
MohamadKh75commented, Jan 22, 2022

Thanks for your flashy quick response ❤️

Yep, and I fixed it with:

{
  "compilerOptions": {},
  "tsc-alias": {
    "replacers": {
      "BaseUrl": { "enabled": false }
    }
  }
}
0reactions
MohamadKh75commented, Feb 23, 2022

@MohamadKh75 The name of baseurl has been changed to baseurl in the 1.6.2 release.

Well, I guess that should be a breaking change then 😁

Not working with neither baseurl nor baseUrl nor BaseUrl, it’s base-url:

{
  "compilerOptions": {},
  "tsc-alias": {
    "replacers": {
      "base-url": { "enabled": false }
    }
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Import-Module: incorrect scope, confusing parameters, wrong ...
I am not sure what but something is wrong: If the documentation is correct then Import-Module imports to the wrong scope by default,...
Read more >
Importing from builtin library when module with same name ...
The best solution, if possible, is to avoid naming your modules with the same name as standard-library or built-in module names. Share.
Read more >
Traps for the Unwary in Python's Import System
The reason this is problematic is that every module in that directory is now potentially accessible under two different names: as a top...
Read more >
When Things Go Wrong — PyInstaller 5.7.0 documentation
Find a module name, then keep clicking the “imported by” links until you find the top-level import that causes that module to be...
Read more >
Built-in Exceptions — Python 3.11.1 documentation
The default traceback display code shows these chained exceptions in ... When set they represent the name of the module that was attempted...
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