Fork me on GitHub
#clojurescript
<
2020-09-11
>
oly13:09:30

Anyone used :npm-deps ? trying to use three.js but it does not appear to work for me

oly13:09:08

{:deps {org.clojure/clojure {:mvn/version "1.10.0"}
        org.clojure/clojurescript {:mvn/version "1.10.773"}
        rum {:mvn/version "0.12.3"}
        cljsjs/three {:mvn/version "0.1.01-1"}
        doughamil/threeagent {:mvn/version "0.0.6"}
        com.bhauman/figwheel-main {:mvn/version "0.2.11"}
        }
 :npm-deps {:three "0.120.1"}}
I thought all i needed todo was add :npm-deps to my deps.edn but the details on this are a bit sparse 😕

Alex Miller (Clojure team)13:09:00

that doesn't go in deps.edn

oly13:09:53

I will try that, never created a build.edn file before usually create figwheel-main.edn dev.cljs.edn and deps.edn for a project will look into it and see if that works

oly13:09:04

build.edn looks very similar to my dev.cljs.edn file I noticed does one have precedent over the other or is it one or the other

dnolen13:09:39

@oliver.marks you have Three as a dep in your deps.edn, you don't shouldn't need :npm-deps if you have that already

oly13:09:10

That was my first stab, it all stems from doughamil/threeagent which fails because three.js does not exists it has suggestions for lein and shadow-clj https://github.com/DougHamil/threeagent but as I am using neither I am looking for a way to make it available

oly13:09:04

been using native clojurescripts libraries and I have noticed a tendency for others to use shadow-clj when it comes to npm

Oliver George23:09:07

Looking for some :target :bundle help

Oliver George23:09:15

% webpack --progress resources/public/js/index.js -o resources/public/js/app.js
92% chunk asset optimization TerserPlugin

Oliver George23:09:28

Takes about 10 mins on my laptop!

Oliver George23:09:03

If I use the TerserPlugin and set compress: false it improves to a few seconds.

Oliver George23:09:30

Presumably caused by chewing on the advanced build output.

Oliver George23:09:53

Are there recommended webpack settings to avoid pointless "compress the compressed file" slowness?

Oliver George23:09:01

(or I might be guessing at the wrong cause)