googleapis / googleapis/google-cloud-node

Consider dropping CommonJS support

Open
#8,413 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3.2k
Forks
712
Avg merge
2d 3h
Merged PRs (30d)
99

Description

## Dependencies dropping support

Several of our dependencies (and other major JS frameworks) have begun dropping support for CommonJS. Here are a few prominent examples relevant to us:

* `node-fetch` - Dropped polyfill for CommonJS after version 3.
* `uuid` - UUID dropped CommonJS after v11 (we were recently forced to remove this library due to vulnerabilities in older versions, we couldn't easily upgrade to newer versions).
* `p-queue`, `p-retry`, `p-map` - Current versions have dropped CJS

## Maintenance cost

In addition to being stuck on older library versions, maintaining both package formats creates complexity for our infrastructure (i.e. librarian, GAPIC generator). Removing the CJS support would enable us to delete a lot of code and reduce the maintenance cost.

## Ecosystem maturity

For our customers, migrating to support ESM has gotten a lot easier. ESM modules can be imported using the legacy `require` function. This significantly reduces the code changes required to consume an ESM library: https://joyeecheung.github.io/blog/2025/12/30/require-esm-in-node-js-from-experiment-to-stability/

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.