Skip to content

Add an option to preserve file extensions in generated auto-imports.d.ts #601

@bsdayo

Description

@bsdayo

Clear and concise description of the problem

AutoImport({
  dirs: ['./components'],
})

This will generate an auto-imports.d.ts like this:

// ...
declare global {
  // ...
  const Comp: typeof import('./components/Comp')['Comp']
  // ...
}
// ...

Deno does not like this syntax and will throw an error like this:

Unable to load a local module: file:///path/to/project/components/Comp
Maybe add a '.tsx' extension. deno(no-local)

It will be useful to allow users preserving the file extensions to solve this problem. Final output will be like this:

// ...
declare global {
  // ...
  const Comp: typeof import('./components/Comp.tsx')['Comp']
  // ...
}
// ...

Suggested solution

Add an option to preserve file extensions in generated auto-imports.d.ts

Alternative

No response

Additional context

deno 2.5.3
unplugin-auto-import 20.2.0
vite 7.1.9

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions