Skip to content

Conversation

jjspace
Copy link
Contributor

@jjspace jjspace commented Jul 22, 2025

Description

By default @monaco-editor/react loads the monaco library from a CDN (through monaco-loader). Normally this would be fine but it means Sandcastle would be unusable when not connected to an external network.

This PR sets up the loader config to make sure we use the local packaged version of monaco so Sandcastle works offline and in isolated networks.
The config is set up using the guidance in the monaco-editor/react readme for vite

I also copied over the Offline sandcastle from #12752 for testing

Issue number and link

Part of #12566

Testing plan

  • run npm run dev from inside the sandcastle package or npm run build-sandcastle and npm start from the root package
  • Open the offline sandcastle demo http://localhost:5173/index.html?id=offline or http://localhost:8080/Apps/Sandcastle2/index.html?id=offline depending how you started it
  • Make sure the code editor loaded and works as expected
  • Open the DevTools network tab and filter by -url:localhost to make sure there are no external requests
  • Turn off your system wifi/network and refresh the example. Make sure it still works.

Author checklist

  • I have submitted a Contributor License Agreement
  • I have added my name to CONTRIBUTORS.md
  • I have updated CHANGES.md with a short summary of my change
  • I have added or updated unit tests to ensure consistent code coverage
  • I have updated the inline documentation, and included code examples where relevant
  • I have performed a self-review of my code

Copy link

Thank you for the pull request, @jjspace!

✅ We can confirm we have a CLA on file for you.

@ggetz
Copy link
Contributor

ggetz commented Aug 8, 2025

Awesome. Looks great, and I can confirm that no cdn assets are being requested.

Thanks @jjspace!

@ggetz ggetz merged commit 8126080 into sandcastle-v2 Aug 8, 2025
9 checks passed
@ggetz ggetz deleted the monaco-loader branch August 8, 2025 16:04
@jjspace jjspace mentioned this pull request Sep 2, 2025
6 tasks
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.

2 participants