Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kricsleo opened this issue Feb 11, 2025 · 2 comments
Open

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

kricsleo opened this issue Feb 11, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@kricsleo
Copy link
Member

kricsleo commented Feb 11, 2025

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/@types+aws-lambda@8.10.119/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

@kricsleo kricsleo added the bug Something isn't working label Feb 11, 2025
@zoeyzhao19
Copy link
Contributor

Also install the aws-lambda itself in the dependencies can correct the output.

@kricsleo
Copy link
Member Author

Also install the aws-lambda itself in the dependencies can correct the output.

But this should be unnecessary because I didn't use the aws-lambda package.
Installing it into dependencies will automatically add it to externals, which is the same as manually needing to add it to externals for it to work, as mentioned above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants