googleapis / googleapis/google-api-nodejs-client

TypeScript typings cause very high memory usage in tsc

Aperta
#2,187 15 commenti 33 reazioni 1 assegnatario Rivendicata da @bcoe Vedi su GitHub
type: feature request
Lingua principale
TypeScript
Stelle
12.2k
Fork
2k
Merge medio
1g 9h
PR unite (30g)
24

Descrizione

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';
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.