Files
supabase/apps
Alaister Young ba95ce7811 fix(studio): short-circuit papaparse's UMD AMD branch via Vite define
Monaco's CDN-loaded loader.js installs an AMD-style \`window.define\` at
runtime. When a chunk containing papaparse evaluates after Monaco has
loaded, papaparse's UMD wrapper (\`typeof define === "function" &&
define.amd\`) hits the AMD branch and calls an anonymous
\`define([], t)\`. Monaco's loader queue then throws "Can only have one
anonymous define call per script file" and the page errors out.

Surfaces in prod builds specifically when navigating from /projects
into a project — that chunk-evaluation order lets Monaco's loader
register first. Direct loads of /project/.../editor happen to load
papaparse first and dodge the conflict.

Substituting the bare identifier \`define.amd\` with \`false\` at Vite
build time forces papaparse down the non-AMD branch in our bundle
(verified in dist: only the CJS / global paths remain). Monaco's
loader.js runs from a CDN script tag and isn't in our bundle, so its
own \`define.amd = true\` write isn't touched.
2026-05-08 17:21:17 +08:00
..
2026-05-07 18:44:15 -04:00