Skip to content

Conversation

@Blackman99
Copy link

@Blackman99 Blackman99 commented Nov 14, 2024

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.

@femboypig
Copy link

"In some" but not all of them.

@callmegautam
Copy link

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.

Copy link

@callmegautam callmegautam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Using window.require makes it globally accessible – avoids reference errors in some browser environments. Nice improvement!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants