Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

fix local run script

Steven Tey57aea47a0c96
diff --git a/apps/web/scripts/run.ts b/apps/web/scripts/run.ts
index 329044674b..107a9cbe9b 100644
--- a/apps/web/scripts/run.ts
+++ b/apps/web/scripts/run.ts
@@ -21,6 +21,16 @@ const child = spawn(
{
stdio: "inherit", // This pipes stdout/stderr directly to the parent process
shell: true, // Allows running commands as if in a shell
+ env: {
+ ...process.env,
+ NODE_OPTIONS: [
+ process.env.NODE_OPTIONS,
+ "--conditions=react-server",
+ "--import=./scripts/runtime/async-local-storage.cjs",
+ ]
+ .filter(Boolean)
+ .join(" "),
+ },
},
);
diff --git a/apps/web/scripts/runtime/async-local-storage.cjs b/apps/web/scripts/runtime/async-local-storage.cjs
new file mode 100644
index 0000000000..f1bae0a510
--- /dev/null
+++ b/apps/web/scripts/runtime/async-local-storage.cjs
@@ -0,0 +1,5 @@
+const { AsyncLocalStorage } = require("node:async_hooks");
+
+if (typeof globalThis.AsyncLocalStorage !== "function") {
+ globalThis.AsyncLocalStorage = AsyncLocalStorage;
+}