Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load Monaco Files From Node Modules Folder #3032

Merged
merged 2 commits into from
Mar 28, 2024
Merged

Load Monaco Files From Node Modules Folder #3032

merged 2 commits into from
Mar 28, 2024

Conversation

jameskerr
Copy link
Member

Fixes #2915

The editor now loads without an internet connection. Instead of reaching out to a CDN, electron intercepts the request and serves it from node modules.

Here is the editor loaded.

CleanShot 2024-03-27 at 15 57 25@2x

And here is the sources tab revealing no network requests.

CleanShot 2024-03-27 at 15 57 17@2x

In order to get this working properly in development, I had to disable web security in the browser windows to allow for cross-origin javascript requests. This is only needed in development because we serve the html from a dev server. In production we serve the files from the same origin that we serve the monaco files, so they are on the same origin already.

I would love to test this in a release to make sure I stitched all the paths together correctly in a release environment.

Copy link
Contributor

@philrz philrz left a comment

Choose a reason for hiding this comment

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

I tested this out on Windows using an artifact from this Actions run and the editor came up fine with my Internet disconnected. LGTM! 👍

@jameskerr
Copy link
Member Author

Nice!

@jameskerr jameskerr merged commit d012848 into main Mar 28, 2024
3 checks passed
@jameskerr jameskerr deleted the monaco branch March 28, 2024 16:18
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.

Monaco editor doesn't load when airgapped
2 participants