Skip to content

Commit a0f9ab8

Browse files
authored
Use local resources when developing (#16083)
1 parent 826533b commit a0f9ab8

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

packages/tools/babylonServer/public/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454
<script src="recast.js"></script>
5555
<script src="https://rawcdn.githack.com/BabylonJS/Extensions/f43ab677b4bca0a6ab77132d3f785be300382760/ClonerSystem/src/babylonx.cloner.js"></script>
5656
<script src="https://rawcdn.githack.com/BabylonJS/Extensions/785013ec55b210d12263c91f3f0a2ae70cf0bc8a/CompoundShader/src/babylonx.CompoundShader.js"></script>
57+
<script>
58+
// make sure the script base url is correct - should be the same as this page's origin
59+
BABYLON.Tools.ScriptBaseUrl = window.location.origin;
60+
</script>
5761
<script src="sceneJs.js"></script>
5862
</body>
5963
</html>

packages/tools/playground/public/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,18 @@ let checkBabylonVersionAsync = function () {
203203

204204
return new Promise((resolve) => {
205205
loadInSequence(frameworkScripts, 0, resolve);
206+
}).then(() => {
207+
// if local, set the default base URL
208+
if (snapshot) {
209+
// eslint-disable-next-line no-undef
210+
globalThis.BABYLON.Tools.ScriptBaseUrl = "https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/" + snapshot;
211+
} else if (version) {
212+
// eslint-disable-next-line no-undef
213+
globalThis.BABYLON.Tools.ScriptBaseUrl = "https://cdn.babylonjs.com/v" + version;
214+
} else if (activeVersion === "local") {
215+
// eslint-disable-next-line no-undef
216+
globalThis.BABYLON.Tools.ScriptBaseUrl = window.location.protocol + `//${window.location.hostname}:1337/`;
217+
}
206218
});
207219
};
208220

0 commit comments

Comments
 (0)