Skip to content

[vue-tsc] does not work with rewriteRelativeImportExtensions #5957

@susnux

Description

@susnux

Vue - Official extension or vue-tsc version

3.2.4

Vue version

3.5.27

TypeScript version

5.9.3

Steps to reproduce

  1. Create Typescript + Vue project
  2. Use rewriteRelativeImportExtensions to allow importing with full extension ("moduleResolution": "bundler")
  3. See that import like import FooBar from './FooBar.vue' are considered invalid by vue-tsc

What is expected?

No errors as per ESM you should import with full file extensions.

What is actually happening?

Errors like:

SettingsApp.vue:100:23 - error TS2876: This relative import path is unsafe to rewrite because it looks like a file name, but actually resolves to "../components/SettingsTabs/ServerTab.vue".

100 import ServerTab from '../components/SettingsTabs/ServerTab.vue'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-tt1ygurt?file=tsconfig.json

See minimal reproduction, run npm run ts:check there.

Any additional comments?

In VSCode no errors are shown, so the Vue + Typescript integration works fine there.
The problem only happens in vue-tsc.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions