Skip to content

ESM vs CJS import woes #2639

Closed Answered by larssn
larssn asked this question in Q&A
Jul 22, 2024 · 2 comments · 2 replies

You must be logged in to vote

So a workaround is doing:

import type { Bucket } from '@google-cloud/storage/build/cjs/src/bucket.d.ts'

And then adding the bucket.d.ts to paths in tsconfig's `compilerOptions:

"paths": {
  "@google-cloud/storage/build/cjs/src/bucket.d.ts": ["./node_modules/@google-cloud/storage/build/cjs/src/bucket.d.ts"]
}

This basically screams "fix me later".

Replies: 2 comments 2 replies

You must be logged in to vote
2 replies
@bartekpacia

@risalfajar

Answer selected by larssn

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants