Skip to content

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

@golopot

Description

@golopot

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions