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

Big package size due to un-deduplicated copy of typescript #2847

Open
1 task done
golopot opened this issue Dec 16, 2024 · 1 comment
Open
1 task done

Big package size due to un-deduplicated copy of typescript #2847

golopot opened this issue Dec 16, 2024 · 1 comment
Labels

Comments

@golopot
Copy link

golopot commented Dec 16, 2024

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

Currently the effective package size of @nest/cli is 34MB, mainly because the package requires a pinned version of typescript, which make npm/yarn unable to deduplicate typescript package. Can we loosen the version requirement for typescript?

% du -sh node_modules/@nestjs/cli | sort -h 
 34M    node_modules/@nestjs/cli
% du -sh node_modules/@nestjs/cli/node_modules/* | sort -h
164K    node_modules/@nestjs/cli/node_modules/cosmiconfig
740K    node_modules/@nestjs/cli/node_modules/fork-ts-checker-webpack-plugin
1.1M    node_modules/@nestjs/cli/node_modules/glob
 31M    node_modules/@nestjs/cli/node_modules/typescript

"typescript": "5.7.2",

Describe the solution you'd like

Change typescript version to something like "^5.7.2".

Teachability, documentation, adoption, migration strategy

No response

What is the motivation / use case for changing the behavior?

Solving this can reduce network cost and build time in local development and CI. This package @nest/cli has about 2 million downloads per week, excluding typescript (4MB after gzip) can save 8TB / per week of transfer cost, which is about $600 USD of CDN hosting cost per week.

@micalevisk
Copy link
Member

micalevisk commented Dec 22, 2024

I think that we should use ~ instead of ^ because, if I'm not wrong, sometimes typescript bumps the minor slice introducing breaking changes to the compiler API (which Nest's CLI uses under the hood)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants