Reducing Lambda size when using googleapis module

The problem

import { google } from "googleapis" ... const peopleApi = google.people({ version: "v1", auth: accessToken }) ...

Even though I was only using one API, every single API from the package was included in the bundle.

The solution

import { people_v1 } from "googleapis/build/src/apis/people"; ... const peopleApi = new people_v1.People({ auth: accessToken }) ...

The problem will soon be solved

Conclusion

Thanks for reading.