fix: deduplicate three.js instance bundled by jsroot#817
Merged
Conversation
Contributor
Author
|
@EdwardMoyse , I’ve opened this PR to address the duplicate Three.js instance issue. I’ve verified locally that the warning no longer appears. Would really appreciate a review when you have time. Thanks! |
Closes HSF#655 Signed-off-by: remo-lab <remopanda7@gmail.com>
ea4404f to
8e13cbc
Compare
Contributor
Author
|
@EdwardMoyse , shall i update anything on this pr? |
Member
|
Thanks very much for this - obviously the preferred solution would be for jsroot to fix this on their side, but in the meantime this seems like a good idea. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #655
JSROOT bundles its own copy of three.js (v174) directly inside
jsroot/modules/three.mjs(~59K lines). This results in a secondthree.js instance being loaded at runtime alongside Phoenix's
three.js (v178), triggering the warning:
Having multiple instances of three.js can lead to issues such as:
instanceofcheck failures across module boundariesFix
Added a Yarn resolution in the root
package.jsonto enforce asingle
three@~0.178.0version across dependencies.Added a postinstall patch script
scripts/patch-jsroot-three.jsthat replaces JSROOT's inlinedthree.js implementation with a simple re-export:
The patch runs automatically during
yarn install, ensuring thefix is applied transparently without requiring any manual steps.
Verification
Confirmed that only one REVISION (178) exists in the bundled
vendor.js. The duplicate version (174) is no longer present.The console warning no longer appears when running Phoenix on
my localhost. I have attached a video below showing a comparison
between the official Phoenix demo website and my local
environment after applying the fix.
Recording.2026-03-07.155825.mp4