Fork me on GitHub
#clojurescript
<
2022-02-01
>
curlyfry16:02:59

I'm using :language-out :ecmascript5 in my compiler options, but I'm seeing a new Map(... in the output. Map is an es6 feature and this is breaking my build in IE11. Anyone have any insight why this happens or how to solve it?

lilactown16:02:08

I don't think that closure compiles calls to ES6+ globals to something else. it only controls how it outputs code syntactically

lilactown16:02:28

I think in this case you should include a polyfill

lilactown16:02:53

or it the new Map is generated by code you wrote you could check for it's existence before using it

lilactown16:02:19

but I would go for the polyfill

curlyfry16:02:34

Thank you for the super quick response @lilactown! Do you have any pointers on how to best include the polyfill in my build?

curlyfry16:02:27

Is :rewrite-polyfills true enough?

lilactown16:02:21

I don't think that works if your language-out is set to ecmascript5

lilactown16:02:55

are you using shadow-cljs?

curlyfry16:02:03

From what I can see, the documentation for :rewrite-polyfills only mentions a limitation for :language-in , not :language-out

lilactown17:02:45

ah my mistake

thheller16:02:31

where do you see the Map in the output? if its from some npm package and you are not using shadow-cljs then those settings do not apply

thheller17:02:14

those settings only apply for optimized builds for the most part too, so if you use :optimizations :none they may have no effect either

curlyfry17:02:25

I'm not using shadow-cljs, and I'm using :optimizations :advanced

curlyfry17:02:54

The only dependency that has changed is clojurescript itself. I'm assuming the Map is somehow coming from the new google closure version.

thheller17:02:27

compile with :pseudo-names true :pretty-print true. that should give a better idea where its coming from exactly

curlyfry17:02:39

Thanks, I'll try it out!

bastilla17:02:44

Sry for bringing up a Heroku related question here again, but the #heroku channel seems to be dead. So in case I want two (instead of just one) js apps to be compiled on the server, where to config this? Originally standard "app.js" will get compiled. On my machine adding an additional "adminapp.js" with all its scaffolding was easy. Both JS apps run in parallel. But Heroku only graps the :app etc. stuff. This makes sense: In dev mode I also need to explicitly call shadow-cljs watch app adminapp. Now I just need to tell Heroku to do likewise. My gut feeling is, customizing these so called 'buildpacks' is the way to go. (Reasoning behind having two JS app is that I don't want to bloat "app.js" with admin-code which isn't for regular users anyway.) Any experience with this? (When reply pls do via thread, THANKS!)

1
thheller17:02:42

how are you compiling on heroku then?

thheller17:02:07

package.json npm run build or something?

bastilla18:02:12

Automatically. Just do git push heroku master and have two buildpacks: heroku/nodejs and second is heroku/clojure. Yes, there is a pakcage,json . This is all I do (git push).

thheller18:02:21

somewhere it needs to execute shadow-cljs right? so I'm guessing there is a package.json "scripts" "build" command?

bastilla18:02:32

oh, let me see!

bastilla18:02:51

Think I found it. In project.clj:

{:uberjar {:omit-source true
             :prep-tasks ["compile" ["run" "-m" "shadow.cljs.devtools.cli" "release" "app"]]
There is my app mentioning. Just need to add a second line, I guess.

bastilla18:02:15

I mean run line.

thheller18:02:20

ah. doesn't need a second line. just :prep-tasks ["compile" ["run" "-m" "shadow.cljs.devtools.cli" "release" "app" "adminapp"]] is fine

1
🙌 1
bastilla18:02:44

Brilliant !!! This makes my day. A million thanks!