cientos
cientos copied to clipboard
fix: add import to lensflare from three addons
I created this issue on three-stdlib:
https://github.com/pmndrs/three-stdlib/issues/396
Until three-stdlib is fixed, how about sticking Lensflare.js from /examples/jsm in Cientos? That avoids build errors and works as expected.
I fixed the upstream issue but would suggest importing from three/addons if possible since this is an ESM-only package. The benefits of three-stdlib are to support CJS builds and offer backwards compatibility. In time, I hope to remove the need for the package entirely. three/addons (since r158) was a first step towards that.
three-stdlib does tree shake completely, where three/addons or three/examples/jsm/** does not. You can mitigate that with the latter (three/addons is impossible to tree-shake unfortunately; needs https://github.com/mrdoob/three.js/pull/26912) by emitting separate JS files with preserveModules or similar and package.sideEffects = false, so bundlers won't include files unless referenced in code.
Importing from three/examples/jsm/** creates hazards since some bundlers require explicit file extensions, which can be lost during transpilation, as it is technically source code (e.g. https://github.com/mrdoob/three.js/issues/24593).