microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
101.17k stars 12.51k forks source link

moduleResolution Bundler and importModuleSpecifierEnding #60478

Open initplatform opened 1 week ago

initplatform commented 1 week ago

Does this issue occur when all extensions are disabled?: Yes

Version: 1.95.1 (Universal) Commit: 65edc4939843c90c34d61f4ce11704f09d3e5cb6 Date: 2024-10-31T05:14:54.222Z Electron: 32.2.1 ElectronBuildId: 10427718 Chromium: 128.0.6613.186 Node.js: 20.18.0 V8: 12.8.374.38-electron.0 OS: Darwin arm64 23.4.0

My project is Node/Fastify written in typescript.

Steps to Reproduce:

  1. Set the compiler compiler options in a tsconfig:
{
    "module": "ESNext",
    "target": "ESNext",
    "moduleResolution": "Bundler"
}

The suggested paths to import, for example, are:

Image

  1. Change to "moduleResolution": "Node" and then reload VSCode.

The suggested paths to import are now:

Image

I want the QuickFix Suggestions from 2. while using "moduleResolution": "Bundler"

I have these settings:

{
    "javascript.preferences.importModuleSpecifierEnding": "minimal",
    "javascript.preferences.importModuleSpecifier": "non-relative"

    "typescript.preferences.importModuleSpecifierEnding": "minimal",
    "typescript.preferences.importModuleSpecifier": "non-relative",
}
initplatform commented 1 week ago

My full ts-configs

tsconfig.app.json tsconfig.base.json tsconfig.json tsconfig.spec.json