🔎 Search Terms
"subpath", "imports", "package.json", "moduleResolution"
🕗 Version & Regression Information
⏯ Playground Link
alan910127/ts-60405-repro
💻 Code
// 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.
🔎 Search Terms
"subpath", "imports", "package.json", "moduleResolution"
🕗 Version & Regression Information
package.jsonimportsfield #55015⏯ Playground Link
alan910127/ts-60405-repro
💻 Code
🙁 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.jsfile extension.🙂 Expected behavior
Since we are using
"moduleResolution": "Bundler", it should insert an import statement without the.jsfile extension.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.