Skip to content

Repo to reproduce "Uncaught Error: Can only have one anonymous define call per script file" when loading stripo with other lib in modern env

Notifications You must be signed in to change notification settings

imaginoCDP/stripo2-react

Repository files navigation

Rsbuild project

// WARNING: Importing @monaco-editor/react together with StripoEditor

// triggers a runtime AMD loader conflict, causing this error:

// "Uncaught Error: Can only have one anonymous define call per script file"

//

// Explanation:

// - Stripo ships its own RequireJS/Almond loader (loader.js) which defines

// window.define for AMD modules.

// - @monaco-editor/react by default loads Monaco via its AMD loader (vs/loader.js)

// which overrides window.define.

// - Having two AMD loaders on the same page causes the error above, because

// RequireJS only allows one anonymous define per script file.

//

// Stripo team: It would be ideal if Stripo could provide either:

// 1. An ESM-compatible build that does not require AMD/RequireJS at runtime, or

// 2. A way to scope their AMD loader so it does not conflict with other libraries.

//

// This would allow integration with modern ESM/React setups without runtime collisions.

import { useMonaco } from "@monaco-editor/react";

Setup

Install the dependencies:

npm install

Get started

Start the dev server, and the app will be available at http://localhost:3000.

npm run dev

Build the app for production:

npm run build

Preview the production build locally:

npm run preview

Learn more

To learn more about Rsbuild, check out the following resources:

About

Repo to reproduce "Uncaught Error: Can only have one anonymous define call per script file" when loading stripo with other lib in modern env

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published