How to import dev-only package in cljs, like cljs-devtools

I want to use cljs-devtools in development but want it automatically removed from release build. How to do that in shadow-cljs?

Inside your build config add

{:target :browser
 :modules ...
 :devtools {:preloads [devtools.preload]}

This did not work properly before shadow-cljs@2.0.6 since shadow-cljs has built-in console formatters that would clash with cljs-devtools. It now detects when cljs-devtools is loaded via preloads and skip loading the built-in formatters.

1 Like

I noticed there was a formatter before. But it did not working recently.