Skip to content

Module build results in "error TS2307: Cannot find module or its corresponding type declarations." #519

Description

@prof-schnitzel

Environment

  • Operating System: Windows_NT
  • Node Version: v20.10.0
  • Nuxt Version: 3.15.4
  • CLI Version: 3.21.1
  • Nitro Version: 2.10.4
  • Package Manager: npm@10.2.3
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://github.com/prof-schnitzel/nuxt-ts-bug-module/tree/main

Describe the bug

In my module.ts I have added the line export type * from './runtime/types' so that my nuxt module exports types that can be used in a consumer app. In the types file I only have this line: export * from '../components/MyDiv.vue'. But when running npm run prepack I get the error src/runtime/types/index.ts(1,15): error TS2307: Cannot find module '../components/MyDiv.vue' or its corresponding type declarations. Why? This seems to be a bug to me.

Additional context

No response

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions