mirror of
https://github.com/supabase/supabase.git
synced 2026-10-11 04:15:04 +03:00
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.