suren-atoyan / monaco-react

Monaco Editor for React - use the monaco-editor in any React application without needing to use webpack (or rollup/parcel/etc) configuration files / plugins
https://monaco-react.surenatoyan.com/
MIT License
3.81k stars 268 forks source link

load monaco editor into a page where require.js already exist without loading from CDN #650

Open dinis4 opened 1 month ago

dinis4 commented 1 month ago

I set my config file to avoid loading from cdn monaco.config({ vs: { path: 'node_modules/monaco-editor/min/vs'} });

on a page require.js is already exist and at a time I load monaco-editor files I get error from require.js error: mismatched anonymous define() modules: function { ... };

I cannot remove requirejs, as this is what the platform provides me.

BrightTan commented 2 weeks ago

I got the same problem,is says: error: Mismatched anonymous define() modules... when I delete window.require, it get well. I can't remove window.require too

BrightTan commented 2 weeks ago

I config like:

import * as monaco from 'monaco-editor';
import { loader } from '@monaco-editor/react';
loader.config({ monaco })