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.

auto import always uses relative (to the current file) module paths in presense of baseUri

See original GitHub issue

back in a day it used to be different

  • at first it was always an absolute path (that is without “./” or “…/” in it) relative to the baseUri
  • then starting at some point it began to always show a popup with 2 options: absolute or relavive
  • now (since like a week ago or so) it just always uses a relative path with “./” and “…/” to the current file no matter what, without asking, which is very frustrating and annoying

how can i get the auto import to use absolute paths like it was back in the day?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

15reactions
mhegazycommented, May 15, 2018

This should be exposed in VSCode (insiders as of now) under “typescript.preferences.importModuleSpecifier”: “non-relative”

1reaction
andy-mscommented, Sep 20, 2018

Before that, I just noticed you’re using .jsx files – you might need to set “javascript.preferences.importModuleSpecifier” instead.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript: How to auto import with absolute paths if baseUrl ...
I want the IDE to auto import modules as absolute paths starting from this base URL. But Intellij IDEA always uses relative paths, ......
Read more >
Auto import in Visual Studio Code only offering absolute path ...
In Visual Studio Code, menu File → Preferences → Settings → User Settings, "typescript.preferences.importModuleSpecifier": "relative".
Read more >
Documentation - Module Resolution - TypeScript
A non-relative import can be resolved relative to baseUrl , or through path mapping, which we'll cover below. They can also resolve to...
Read more >
ECMAScript modules | Node.js v19.3.0 Documentation
Outside of those cases, Node.js will use the CommonJS module loader. ... They refer to a path relative to the location of the...
Read more >
Configuring Jest
You can use --config flag to pass an explicit path to the file. ... that all imported modules in your tests should be...
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