Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

[Pioneering] Add bundle size detection/warning feature for NPM packages #792

@kantord

Description

@kantord

In frontend development, when working with dependencies that are going going to be shipped to the end user through the network, the size of the dependency is an additional concern as it not only affects the deployment/build times, but also the performance perceived by the end user.

There are various levels of detail/accuracy in estimating the network impact of a dependency:

  • Simply measure the size of the folder in node_modules
  • Measure only the binaries/entry point
  • Also calculate the savings though gzip (this is what https://bundlephobia.com/) does
  • Actually attempt to understand the build system used by the project and accurately calculate to the byte

The last version is very tricky, because it has to take into account different build systems/frameworks, so probably we should aim for the "gzipped entry points" version, but we should do some research to understand if there is some library we can leverage to get a more accurate estimation.

How we could integrate this in CodeGate? Depending on the chosen method, there are some question about how to process the prompt and how to calculate the data, but we could show a message to the end user that suggest smaller alternatives when a huge dependency is recommended by the AI, or when the user directly asks for an example using that dependency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions