jado
jado
CDCloudflare Developers
Created by CanRau on 12/12/2024 in #workers-help
Uncaught ReferenceError: MessageChannel is not defined
this config worked for me:
// @ts-check
import { defineConfig } from "astro/config";
import cloudflare from "@astrojs/cloudflare";

import react from "@astrojs/react";

// https://astro.build/config
export default defineConfig({
output: "server",
adapter: cloudflare(),
integrations: [react()],
vite: {
resolve: {
// Use react-dom/server.edge instead of react-dom/server.browser for React 19.
// Without this, MessageChannel from node:worker_threads needs to be polyfilled.
alias: import.meta.env.PROD && {
"react-dom/server": "react-dom/server.edge",
},
},
},
});
// @ts-check
import { defineConfig } from "astro/config";
import cloudflare from "@astrojs/cloudflare";

import react from "@astrojs/react";

// https://astro.build/config
export default defineConfig({
output: "server",
adapter: cloudflare(),
integrations: [react()],
vite: {
resolve: {
// Use react-dom/server.edge instead of react-dom/server.browser for React 19.
// Without this, MessageChannel from node:worker_threads needs to be polyfilled.
alias: import.meta.env.PROD && {
"react-dom/server": "react-dom/server.edge",
},
},
},
});
23 replies
CDCloudflare Developers
Created by CanRau on 12/12/2024 in #workers-help
Uncaught ReferenceError: MessageChannel is not defined
ah this is an issue with astro not using the edge renderer, workaround is here: https://github.com/withastro/adapters/pull/436#issuecomment-2525190557
23 replies
CDCloudflare Developers
Created by CanRau on 12/12/2024 in #workers-help
Uncaught ReferenceError: MessageChannel is not defined
23 replies
CDCloudflare Developers
Created by CanRau on 12/12/2024 in #workers-help
Uncaught ReferenceError: MessageChannel is not defined
mm i see
23 replies
CDCloudflare Developers
Created by CanRau on 12/12/2024 in #workers-help
Uncaught ReferenceError: MessageChannel is not defined
@Mike Nomitch | Workers PM hi 👋 would opening an issue on workerd be appropriate for this?
23 replies
CDCloudflare Developers
Created by CanRau on 12/12/2024 in #workers-help
Uncaught ReferenceError: MessageChannel is not defined
Would love a solution to this! It looks like someone else hit the unsupported MessageChannel API in Vercel's Edge Runtime https://github.com/vercel/next.js/issues/60337 but this is the only issue I can find & it was never resolved, so they might still not support it. Not sure if this is in the scope for workerd or if React should revert its usage.
23 replies