Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/soft-rats-punch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@opennextjs/cloudflare": patch
---

polyfill import.meta.url
3 changes: 3 additions & 0 deletions packages/cloudflare/src/cli/templates/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ function initRuntime() {

globalThis.__dirname ??= "";
globalThis.__filename ??= "";
// Some packages rely on `import.meta.url` but it is undefined in workerd
// For example it causes a bunch of issues, and will make even import crash with payload
import.meta.url ??= "file:///worker.js";

// Do not crash on cache not supported
// https://github.com/cloudflare/workerd/pull/2434
Expand Down