Skip to content

Wrong module path in the output of .d.ts #510

@kricsleo

Description

@kricsleo

Environment

Node: v22.13.1
Unbuild: 3.3.1(latest)

Reproduction

https://stackblitz.com/edit/vitejs-vite-wtwf2cpw?file=src%2Findex.ts,build.config.ts&terminal=build

Describe the bug

Context: #471 (comment)

The current output of .d.ts is:

import { Context } from '/home/projects/github-7jr8pu/node_modules/.pnpm/@[email protected]/node_modules/@types/aws-lambda/index.d.ts';

and it should be:

import { Context } from 'aws-lambda';

This might be related to changes #471 and #488.

Moreover, it seems that there's currently no way to bundle @types/*. I've already tried rollup.inlineDependencies true, and the .d.ts results are the same as the error content example above.

Additional context

Additional information is that if aws-lambda is explicitly added to the externals, the result is normal.
But adding this shouldn't be mandatory (I'm not sure 🤔), at least it shouldn't affect the correctness of the output.

Logs

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