Skip to content

Vite + Vue 3 + Typescript NPM import issue. "TS2306: File '.../index.d.ts' is not a module." #4953

@Oskar-Nilsen-Roos

Description

@Oskar-Nilsen-Roos

Version

3.2.16

Reproduction link

github.com

Steps to reproduce

  1. Clone repo
  2. npm run build

What is expected?

"consuming-app" successfully builds

What is actually happening?

src/App.vue:4:27 - error TS2306: File '/Users/user/Projects/vite-v3-ts-import-bug/packages/component/index.d.ts' is not a module.

4 import { Component } from '../../component'
                            ~~~~~~~~~~~~~~~~~

Encountered this bug when importing an NPM package containing an exported Vue component using Typescript, with typings using vue-tsc. The component is imported successfully, and it's more likely to be an issue with Typescript, since using ts-ignore will have it build successfully.

The "component" package is set up according to vite library mode documentation.

There might be something wrong with my setup, but not sure where to look.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions