-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot set property ACESFilmicToneMapping of #<Object> which has only a getter #19469
Comments
This isn't a great answer, but for what it's worth, the const THREE = global.THREE = require('three');
require('three/examples/js/loaders/GLTFLoader.js');
const loader = new THREE.GLTFLoader(); I realize the reliance on global scope there is not ideal, and may cause issues with some bundlers, but this approach has worked for many CJS-based projects. Longer term — please be aware that we may remove the |
The problem isn't so much the cjs, but the module resolution. you can't offer two namespaces but then import one relatively in add-ons - that is the root cause for so many problems down the line. today it caused half of the codesandboxes we offer to go down (deps probably not pinned, who knows what did it) , tomorrow it will be something else.
That would really be the end of all woes! That day can't come soon enough. Anything that helps the current module situation is very welcome. :-) |
I thought we already discussed this in the past and we agreed that this was an issue with codesandbox not using the |
Marking this as a duplicate of #17482 then. |
For a long time threejs had trouble with commonjs environments, see #17220 It affects all jsm files that mutate the namespace, ReactAreaLights for instance.
A dirty workaround existed:
It works around threeejs broken module resolution by merging the two namespaces that it creates into one. (And yes, using threejs+jsm in cjs currently loads two versions of the same library with two separate namespaces). But something in threejs took that away recently:
sandbox: https://codesandbox.io/s/three-fiber-useloader-rohv5?file=/src/index.js:0-103
Could threejs please remove cjs? By offering
"main": "build/three.js"
it appears as if it does support cjs, but jsm most definitively doesn't, since it refers tothree/build/three.module
.I don't understand for whom that cjs file is for tbh. You can't use any third party lib or add-on reliably, including examples/jsm - and in every case you're loading threejs twice. Why would anyone want this? It's causing so much trouble, i can't count the bug tickets i get b/c of this. It would be such a relief to see that file go, or at least the entry in package.json.
The text was updated successfully, but these errors were encountered: