Fix turndown ESM build compatibility with Cloudflare Workers (#339)
This commit is contained in:
parent
41d37792e7
commit
93cf32081a
@ -21,6 +21,21 @@ export default defineConfig(({ mode }) => {
|
|||||||
const emitSourcemaps = env.POSTHOG_SOURCEMAPS === "true";
|
const emitSourcemaps = env.POSTHOG_SOURCEMAPS === "true";
|
||||||
|
|
||||||
return {
|
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: [
|
envPrefix: [
|
||||||
"VITE_",
|
"VITE_",
|
||||||
"AUTH_MODE",
|
"AUTH_MODE",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user