Fork me on GitHub
#shadow-cljs
<
2021-06-12
>
Ertugrul Cetin15:06:23

Hi all, I'm having a problem with @react-three/drei library. When I require it ["@react-three/drei" :refer [Sky Environment]], I get this error:

Closure compilation failed with 2 errors
--- node_modules/three-stdlib/index.cjs.js:2
Illegal variable reference before declaration: i
--- node_modules/three-stdlib/index.cjs.js:2
Illegal variable reference before declaration: t
I've tried a couple of :js-options options did not work out:
{:js-provider :shadow
 :keep-native-requires true
 :output-feature-set :es6
 :closure-output-charset "ascii"}
Here is my package.json:
"@pmndrs/branding": "^0.0.8",
"@react-three/cannon": "2.1.2",
"@react-three/drei": "6.0.2",
"@react-three/fiber": "7.0.1",
"@react-three/postprocessing": "2.0.4",
"@types/three": "0.129.1",
"lodash-es": "^4.17.21",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"three": "0.129.0",
Any suggestions?

thheller16:06:34

not much you can do config-wise. according to the closure-compiler there seems to be some invalid code. I guess you can use webpack as described in this post https://code.thheller.com/blog/shadow-cljs/2020/05/08/how-about-webpack-now.html

thheller16:06:09

which version of shadow is this? if not the latest maybe an upgrade might help

thheller16:06:02

sometimes code is actually invalid and webpack just happens to make it work due to its processing

Ertugrul Cetin21:06:41

@thheller "shadow-cljs": "2.12.5"