Fix turndown ESM build compatibility with Cloudflare Workers (#339)

This commit is contained in:
Ben Senescu 2026-07-03 21:53:55 -04:00 committed by GitHub
parent 41d37792e7
commit 93cf32081a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,6 +21,21 @@ export default defineConfig(({ mode }) => {
const emitSourcemaps = env.POSTHOG_SOURCEMAPS === "true";
return {
resolve: {
alias: {
// TODO: Remove this workaround once fixed upstream — either turndown
// drops the bare require from its ESM build, or @cloudflare/think
// stops eagerly importing just-bash/turndown at module init
// (https://github.com/cloudflare/agents/issues/1673).
//
// turndown's ESM build (pulled in via just-bash's html-to-markdown
// command) contains a bare CommonJS `require("@mixmark-io/domino")`
// that the Cloudflare Workers runtime rejects at deploy time (error
// 10021). Its CJS build goes through Vite's CommonJS transform, which
// rewrites that require into a bundled import.
turndown: "turndown/lib/turndown.cjs.js",
},
},
envPrefix: [
"VITE_",
"AUTH_MODE",