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.

Breaking change on `v1.4.2`: replacement for non-alias :exploding_head:

See original GitHub issue

Hi! I’ve got a second bug spotted on (first minor here), and since 1.4.2 and I think this one is quite interesting as it’s replacing a NodeJs native library import statement.

Description / steps to reproduce

  1. tsconfig.json alias config doesn’t matter!
"path": {} // empty
  1. file to convert /utils/index.js, which does contain a Node.js native package (for instance cluster, but it works for a child_process, fs or whatever)
const cluster = require("cluster");
  1. And, I’ve got some file /cluster.js:
// the bug occurs as long the file "cluster" exists

The /utils/index.js will be rewritten as following 🤯 🤯 🤯

const cluster = require("../cluster");

Origin

That’s not the same source as the minor bug I’ve spot! This issue is coming from this commit: https://github.com/justkey007/tsc-alias/commit/18b252a5de960b813490ce6fa6e3a447b943d61e

// Finding breaking change in tagged versions
1.4.1: OK! :)
1.4.2: BROKEN!

// Finding breaking in commits
e980fee75851012c52878c0d23c2dc05fe83bce4: (1.4.1): OK
18b252a5de960b813490ce6fa6e3a447b943d61e: BROKEN

... note it's broken to current version 1.6.4

I’m trying to spot exactly which code did this regression, probably replaceBaseUrlImport but I’m not sure to be able to edit this code without breaking things 😞

Let me know if I can help

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
raouldeheercommented, Mar 14, 2022

“All module imports with non-relative names are assumed to be relative to the baseUrl.” -typescript handbook This is why base-url is enabled by default.

2reactions
raouldeheercommented, Mar 14, 2022

The name of BaseUrl has been changed to base-url all lowercase.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Choosing between alias and non-alias records
Choose whether you want to create alias records in Amazon Route 53.
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