Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"typescript.preferences.importModuleSpecifier": "project-relative" is not as intended #58114

Closed
jeemercado opened this issue Apr 7, 2024 · 8 comments
Assignees
Labels
Fixed A PR has been merged for this issue Needs More Info The issue still hasn't been fully clarified

Comments

@jeemercado
Copy link

jeemercado commented Apr 7, 2024

"typescript.preferences.importModuleSpecifier": "project-relative" is not working properly anymore after the new update. I tested this for Nx projects.

  • VS Code Version: 1.88.0
  • OS Version: macOS M1 Ventura 13.6

Steps to Reproduce:

  1. Set typescript.preferences.importModuleSpecifier to project-relative
@vscodenpa
Copy link

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.88.0. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

@IllusionMH
Copy link
Contributor

/needsMoreInfo

@vscodenpa
Copy link

Thanks for creating this issue! We figured it's missing some basic information or in some other way doesn't follow our issue reporting guidelines. Please take the time to review these and update the issue.

Happy Coding!

@ivan-palatov
Copy link

Can confirm it doesn't work as intended and makes imports from absolute path instead of project relative.

It started working like this after the latest update.

Current behaviour:

When importing functions from a current project, vscode makes the following import:

import { createMarkerElement } from "apps/client/src/pages/MainPage/useVehiclesLayer/createMarkerElement";

Expected behaviour:

import { createMarkerElement } from "./createMarkerElement";

@itseramin

This comment has been minimized.

@mjbvz mjbvz transferred this issue from microsoft/vscode Apr 8, 2024
@mjbvz mjbvz removed their assignment Apr 8, 2024
@andrewbranch
Copy link
Member

Can someone please provide an example repo with reproduction steps that show this happening?

@andrewbranch andrewbranch self-assigned this Apr 8, 2024
@andrewbranch andrewbranch added the Needs More Info The issue still hasn't been fully clarified label Apr 8, 2024
@ivan-palatov
Copy link

ivan-palatov commented Apr 9, 2024

@andrewbranch created an example here https://github.com/ivan-palatov/vscode-typescript-imports-bug

On the first try everything worked fine tho, but after I changed typescript version - it broke. Not sure why. I thought it had something to do with not being on the latest version, but right now on a project Im working on it is still happening even on the latest ts version.

Edit: If I swith typescript in vscode to workspace version (5.4.4 instead of vscode's 5.4.3) everything works fine, at least right now.

@andrewbranch
Copy link
Member

Thanks @ivan-palatov! I’m going to close this as fixed, but if anyone can reproduce on 5.4/nightly TS, please comment with repro steps and I’ll reopen and investigate more. I’m guessing this bug was accidentally fixed by code shuffling around in #55015.

@andrewbranch andrewbranch added the Fixed A PR has been merged for this issue label Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed A PR has been merged for this issue Needs More Info The issue still hasn't been fully clarified
Projects
None yet
Development

No branches or pull requests

7 participants