Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Type generation is broken for subfolders (subfolder is imported with .js extension) #308

@madskronborg

Description

@madskronborg

Reproduction

Stackblitz

Build command: cd ~/projects/vitejs-vite-tu4fsx/my-module/ && npm run dev:build && npm run prepack

Describe the bug

After upgrading from 0.5.5 to 0.8.0 the generated bundle has invalid import paths for types that exist in subfolders.

We have e.g. the following structure in our nuxt module runtime/ folder:

src/
  runtime/
    types/
      index.ts (export * from './components')
      components/
        index.ts (export * from './Alert')
        Alert.ts

Which results in the following build:

dist/
  runtime/
    types/
      index.d.ts (export * from './components.js')
      components/
        index.d.ts (export * from './Alert.js')
        Alert.d.ts
        Alert.js

Where the path ./components.js is invalid. It should be: ./components.
I am also unsure whether components/index.d.ts in the build should export ./Alert.js or Alert.d.ts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions