Closed as not planned
Closed as not planned
Description
🔎 Search Terms
"subpath", "imports", "package.json", "moduleResolution"
🕗 Version & Regression Information
- This changed in commit or PR Add auto-import for the
package.json
imports
field #55015 - This is the behavior in every version I tried, and I reviewed the FAQ for entries about imports, completions
⏯ Playground Link
💻 Code
// tsconfig.json
{
"compilerOptions": {
"moduleResolution": "Bundler"
}
}
// src/foo/bar/baz.ts
export function baz() {}
// src/one/two/three.ts
// actual - import { baz } from "#foo/bar/baz.js";
// expected - import { baz } from "#foo/bar/baz";
🙁 Actual behavior
When auto-importing the function baz
(either through completion or code action), the typescript language server will insert an import statement with a .js
file extension.
import { baz } from "#foo/bar/baz.js";
🙂 Expected behavior
Since we are using "moduleResolution": "Bundler"
, it should insert an import statement without the .js
file extension.
import { baz } from "#foo/bar/baz";
Additional information about the issue
I've seen a similar issue #59200, but I cannot reproduce the issue, with the same setup. Therefore, I think my issue might be related with the subpath imports.