monaco-editor icon indicating copy to clipboard operation
monaco-editor copied to clipboard

docs: change `var require` to `window.require`

Open Blackman99 opened this issue 1 year ago • 1 comments

The browser script edtior sample use var require = ...

In some senario var would be auto replaced to const (ESLint eg.). And would cause worker not found, so as other resource files.

Blackman99 avatar Nov 14 '24 09:11 Blackman99

"In some" but not all of them.

femboypig avatar Mar 22 '25 13:03 femboypig

Good fix. Changing var require to window.require ensures that the require configuration is globally available for Monaco's AMD loader (loader.js). This avoids conflicts with local require definitions and aligns with how Monaco expects the global require to be defined.

callmegautam avatar Jun 21 '25 13:06 callmegautam