googleapis / googleapis/google-api-nodejs-client

TypeScript typings cause very high memory usage in tsc

Offen
#2,187 15 Kommentare 33 Reaktionen 1 zugewiesene Person Beansprucht von @bcoe Auf GitHub ansehen
type: feature request
Vorherrschende Sprache
TypeScript
Sterne
12.2k
Forks
2k
Ø Merge
1 T. 9 Std.
Gemergte PRs (30 T.)
24

Beschreibung

When importing `googleapis` within a TypeScript project, `tsc` takes up a large amount of memory (500 MB+). This appears to be the case because when `googleapis` is imported, it imports the type definition files for every single API that Google has, even if only a single API (e.g. `drive_v3`) is required.

#### Environment details

- OS: Ubuntu 20.04 LTS
- Node.js version: 10.20.1 (LTS)
- npm version: N/A (We don't use npm instally, but we use yarn v1.22.4)
- `googleapis` version: 51.0.0
- `typescript` version: 3.8.3

#### Steps to reproduce

Please see reproduction repository here: https://github.com/yjwong/tsc-googleapis-memory-usage

Essentially, even just a simple:

```typescript
import { google } from 'googleapis';
```

Will result in high memory usage from `tsc`.

There is also a related StackOverflow question:
https://stackoverflow.com/questions/56599477/typescript-googleapis-surge-in-memory-used

#### Workaround

Import the APIs individually, like so (example is Google Drive SDK v3):

```typescript
import { drive_v3 } from 'googleapis/build/src/apis/drive/v3';
import { AuthPlus } from 'googleapis-common/build/src/authplus';
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.