How can we avoid awaiting import('cloudflare:workers') so code works in localhost and prod?

Stack: Tanstack Start

Currently I have a db/index.ts

if (import.meta.env.DEV) {
// do stuff
} else {
const { env } = await import('cloudflare:workers')
}

Because if I don't wait the cloudflare:workers, it gives an error in dev. Is there a way around this?
Was this page helpful?