Open Tobbe opened 1 week ago
It only bundles in dev dependencies that are imported.
For example, tsx is also designed to be used with npx and has typescript
as a dev dependency. But since it doesn't import it, it doesn't get bundled in.
You can vet the results with pkg-size: https://pkg-size.dev/tsx
There seems to be a confusion here so the issue itself is not valid, but I'm going to leave this open with the action item to be to improve the docs to clarify this.
the issue itself is not valid
Do you think the recommendation to include types is also still valid even for things like CLI tools and other packages that are not libraries?
Good point. We should turn that recommendation off if the package is only a CLI (only has the bin
property).
Feature request
I'd like an option to totally ignore all devDependencies and to not recommend moving types to the dependencies array
Motivations
I might very well be misunderstanding how things works. If so, please correct me. But for my use case I think it'd make sense to have an option to totally ignore devDependencies. And also to not print the recommendation to bundle types (Recommendation: "@types/findup-sync" is externalized because "findup-sync" is in "dependencies". Place "@types/findup-sync" in "dependencies" as well so users don't have missing types.)
I'm using pkgroll to bundle up a TS project to be used by npx. So it's not supposed to be consumed by anyone, so there is no need for any type information. And my devDeps are things like "tsx" and "typescript". I don't see a reason to bundle stuff like that. (Maybe tree shaking already takes care of that concern)
Alternatives
One alternative is what I'm doing now: Just ignore the recommendations - and hope for the best when it comes to tree shaking taking care of not actually bundling my devDeps
Additional context
No response
Bugs are expected to be fixed by those affected by it
Compensating engineering work financially will speed up resolution