Rename viewer bundles .js -> .mjs so they stop leaking into the main realm
ComfyUI auto-imports every web/**/*.js into the shared main page; the four big bundles (three, vtk-gltf, viewer-bundle-vtk, gsplat) only ever run inside the viewer iframes but were getting pulled into the main document too, where they wrote window.THREE / window.vtk / globalThis.* and could collide with any other 3D pack. The **/*.js glob only matches .js, so renaming to .mjs drops them from the auto-import while the iframes still load them via classic <script src> (mime resolves to text/javascript). window.* pollution from these bundles is gone from the main realm.
This commit is contained in:
@@ -350,7 +350,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="./js/vtk-gltf.js"></script>
|
||||
<script src="./js/vtk-gltf.mjs"></script>
|
||||
|
||||
<script>
|
||||
// Get VTK.js classes
|
||||
|
||||
@@ -341,8 +341,8 @@
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<script src="./js/vtk-gltf.js"></script>
|
||||
<script src="./js/viewer-bundle-vtk.js"></script>
|
||||
<script src="./js/vtk-gltf.mjs"></script>
|
||||
<script src="./js/viewer-bundle-vtk.mjs"></script>
|
||||
|
||||
<script>
|
||||
// Get VTK.js classes
|
||||
|
||||
@@ -330,7 +330,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="./js/vtk-gltf.js"></script>
|
||||
<script src="./js/vtk-gltf.mjs"></script>
|
||||
|
||||
<script>
|
||||
// Get VTK.js classes
|
||||
|
||||
@@ -146,10 +146,10 @@
|
||||
|
||||
<!--
|
||||
Load bundled Three.js and all dependencies.
|
||||
The bundle is expected at ../js/viewer-bundle-three.js relative to this HTML file.
|
||||
The bundle is expected at ../js/viewer-bundle-three.mjs relative to this HTML file.
|
||||
When copied by prestartup_script.py, the directory structure should be:
|
||||
web/viewer_fbx.html
|
||||
web/js/viewer-bundle-three.js
|
||||
web/js/viewer-bundle-three.mjs
|
||||
-->
|
||||
<script>
|
||||
// Dynamically determine the bundle path based on how this HTML is loaded
|
||||
@@ -171,7 +171,7 @@
|
||||
|
||||
// Create script element to load the bundle
|
||||
var bundleScript = document.createElement('script');
|
||||
bundleScript.src = baseUrl + 'js/viewer-bundle-three.js';
|
||||
bundleScript.src = baseUrl + 'js/viewer-bundle-three.mjs';
|
||||
bundleScript.onload = function() {
|
||||
console.log('[FBX Viewer] Three.js bundle loaded from:', bundleScript.src);
|
||||
initViewer();
|
||||
|
||||
@@ -293,7 +293,7 @@
|
||||
}
|
||||
|
||||
var bundleScript = document.createElement('script');
|
||||
bundleScript.src = baseUrl + 'js/viewer-bundle-three.js';
|
||||
bundleScript.src = baseUrl + 'js/viewer-bundle-three.mjs';
|
||||
bundleScript.onload = function() {
|
||||
console.log('[UniRig Compare] Three.js bundle loaded');
|
||||
initViewer();
|
||||
|
||||
@@ -439,7 +439,7 @@
|
||||
}
|
||||
|
||||
var bundleScript = document.createElement('script');
|
||||
bundleScript.src = baseUrl + 'js/viewer-bundle-three.js';
|
||||
bundleScript.src = baseUrl + 'js/viewer-bundle-three.mjs';
|
||||
bundleScript.onload = function() {
|
||||
console.log('[FBX Debug Viewer] Three.js bundle loaded from:', bundleScript.src);
|
||||
initViewer();
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Load bundled gsplat.js -->
|
||||
<script src="./js/gsplat-bundle.js"></script>
|
||||
<script src="./js/gsplat-bundle.mjs"></script>
|
||||
|
||||
<script type="module">
|
||||
// Use the globally exported GSPLAT
|
||||
|
||||
@@ -297,7 +297,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="./js/vtk-gltf.js"></script>
|
||||
<script src="./js/vtk-gltf.mjs"></script>
|
||||
|
||||
<script>
|
||||
// Get VTK.js classes
|
||||
|
||||
@@ -81,8 +81,8 @@
|
||||
<button id="resetSlider">Reset Sliders</button>
|
||||
</div>
|
||||
|
||||
<script src="./js/vtk-gltf.js"></script>
|
||||
<script src="./js/viewer-bundle-vtk.js"></script>
|
||||
<script src="./js/vtk-gltf.mjs"></script>
|
||||
<script src="./js/viewer-bundle-vtk.mjs"></script>
|
||||
|
||||
<script>
|
||||
const vtkFullScreenRenderWindow = vtk.Rendering.Misc.vtkFullScreenRenderWindow;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
button.active { background: #2c5d8a; border-color: #4a90c0; }
|
||||
button:hover { background: #444; }
|
||||
</style>
|
||||
<script src="./js/vtk-gltf.js"></script>
|
||||
<script src="./js/vtk-gltf.mjs"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="wrap">
|
||||
|
||||
@@ -151,9 +151,9 @@
|
||||
</div>
|
||||
|
||||
<!-- Load VTK.js bundle -->
|
||||
<script src="./js/vtk-gltf.js"></script>
|
||||
<script src="./js/vtk-gltf.mjs"></script>
|
||||
<!-- Load unified viewer bundle -->
|
||||
<script src="./js/viewer-bundle-vtk.js"></script>
|
||||
<script src="./js/viewer-bundle-vtk.mjs"></script>
|
||||
|
||||
<script>
|
||||
// Use unified viewer modules
|
||||
|
||||
@@ -96,9 +96,9 @@
|
||||
</div>
|
||||
|
||||
<!-- Load VTK.js bundle with GLTFImporter support -->
|
||||
<script src="./js/vtk-gltf.js"></script>
|
||||
<script src="./js/vtk-gltf.mjs"></script>
|
||||
<!-- Load unified viewer bundle -->
|
||||
<script src="./js/viewer-bundle-vtk.js"></script>
|
||||
<script src="./js/viewer-bundle-vtk.mjs"></script>
|
||||
|
||||
<script>
|
||||
// Use the unified viewer module
|
||||
|
||||
Reference in New Issue
Block a user