mirror of
https://github.com/google/blockly.git
synced 2026-01-10 18:37:09 +01:00
Unlike goog.provide packages, goog.module modules are loaded using XMLHttpRequest in uncompiled mode. Because browsers treat file: URLs as each being a separate, unique origin, this means that CORS rules prevent goog.module modules being loaded from a file URL. To work around this, use the http-server npm to serve the repository root directory on localhost:8080. Provide a script so that you can type `npm start` to start the local http server and automatically open a browser window pointing at tests/playground.html. Modify the setBackgroundColour function in the playgrounds to provide the usual lilac background on locahost URLs and a sickly green one if using a file: URL, all of which will soon stop working. (The background doesn't actually appear to be visible in the advanced playground.)