Skip to content

fix(core): ignore type imports in generatePackageJson #31780

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Adig0
Copy link

@Adig0 Adig0 commented Jun 30, 2025

Current Behavior

When using generatePackageJson, the resulting package.json includes packages that are only referenced as type-only imports (e.g., import type { X } from 'some-package'). These type-only imports should not appear in the final package.json since they are erased during compilation and not required at runtime.
This leads to unnecessary dependencies being installed in production, which bloats deployments and increases cold start time.

Expected Behavior

generatePackageJson should omit packages that are only used in type-only imports. This ensures the package.json includes only the actual runtime dependencies, avoiding unnecessary installs and potential dependency mismatches.

Related Issue(s)

Fixes #31263

@Adig0 Adig0 requested review from FrozenPandaz, jaysoo, AgentEnder, a team and Coly010 as code owners June 30, 2025 07:53
Copy link

vercel bot commented Jun 30, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview Jul 3, 2025 9:09pm

@Adig0 Adig0 marked this pull request as draft June 30, 2025 07:53
@Adig0 Adig0 marked this pull request as ready for review June 30, 2025 20:27
@Adig0 Adig0 marked this pull request as ready for review July 3, 2025 20:58
@Adig0 Adig0 requested a review from a team as a code owner July 3, 2025 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

generatePackageJson includes type imports in package.json
1 participant