Fork me on GitHub
#shadow-cljs
<
2023-09-29
>
itaied06:09:34

Hey all, I'm facing a problem with shadow-cljs release :dev running with watch :dev and webpack the app works. Executing shadow-cljs release :dev && yarn webpackresults in the following error:

main.js:2050 Uncaught TypeError: Cannot read properties of undefined (reading 'Fj')
    at main.js:2050:75
    at main.js:3074:4
from: var Faa = new google.Kb.Fj.pb; webpack:
const path = require("path");
const Dotenv = require("dotenv-webpack");

module.exports = {
  mode: process.env["NODE_ENV"] || "development",
  optimization: {
    minimize: process.env["NODE_ENV"] === "development",
  },
  entry: "./target/index.js", // Entry point for your application
  output: {
    filename: "libs.js", // Output bundle file name
    path: path.resolve(__dirname, "public/js"), // Output directory
  },
  resolve: {
    extensions: [".js", ".mjs"], // Allow importing both .js and .mjs files without specifying the extension
  },
  plugins: [new Dotenv()],
  module: {
    rules: [
      { test: /\.json$/, type: "json", use: ["json-loader"] },
      {
        test: /\.css$/i,
        use: ["style-loader", "css-loader"],
      },
      {
        test: /\.m?js/,
        type: "javascript/auto", // Treat .mjs files as JavaScript modules
        resolve: {
          fullySpecified: false,
        },
      },
      // {
      //   test: /\.js$/, // Match JavaScript files
      //   use: "babel-loader", // Example loader (replace with your specific loader)
      //   exclude: /node_modules/, // Exclude node_modules
      // },
    ],
  },
};
 
shadow:
:dev {:target :browser
               :modules {:main {:init-fn main/init}}
               :build-hooks [#_(portal.shadow.remote/hook)
                             (dev.core/rcf-shadow-hook)]
               :devtools {:preloads [flow-storm.api
                                     #_portal.shadow.preload]}
               :js-options
               {:js-provider :external
                :external-index "target/index.js"
                :ignore-asset-requires true}}

thheller06:09:26

looks like you are missing externs? do you not get warnings about that?

itaied06:09:11

i do have both libs and main in the folder

itaied06:09:34

and index.html imports both of them and it works using compile and not release

thheller07:09:38

yes, release applies optimizations that minify yyour code

thheller07:09:41

compile does not do that

thheller07:09:56

these optimizations sometimes require "externs", to prevent renaming/shortening of certain stuff

thheller07:09:20

normally the places that cause problems should cause compiler warnings

thheller07:09:33

so that is why I'm asking whether you get compilation warnings when making the build

itaied07:09:01

no i dont have warnings and i have set a few externs before when i had warnings

itaied07:09:17

I have set the externs only when I had warnings, is there any other place required, like a global place?

thheller07:09:20

you can set shadow-cljs release :dev --pseudo-names to make it a little more apparent where the error is

thheller07:09:56

no, I'm not currently aware of cases where externs are required but no warnings are generated

thheller07:09:12

except I guess when you are actively writing bad code to circumvent the externs handling

thheller07:09:29

pseudo names should help you figure out where the problem is

thheller07:09:40

if you paste that here I can maybe provide more info

itaied07:09:06

yea thanks, it points me to google map auto complete

itaied07:09:35

var $locations$locations_service$$ = new google.$maps$.$places$.$AutocompleteService$();

thheller07:09:59

and what is the CLJS code producing this?

itaied07:09:37

cljs file:
(def locations-service (new google.maps.places.AutocompleteService))

index.html
    <script
      src=""
      type="text/javascript"
    ></script>

thheller07:09:05

that produces no warning? that is definitely invalid

itaied07:09:23

I have added js extern now

itaied07:09:27

(def ^js locations-service (new google.maps.places.AutocompleteService))

thheller07:09:34

that is incorrect

thheller07:09:53

try (def locations-service (js/google.maps.places.AutocompleteService.))

itaied07:09:23

can you explain please the differences?

thheller07:09:43

well google.maps.places.AutocompleteService on its own is an invalid symbol

thheller07:09:12

since you are accessing the global google variable that should be js/google.maps.places.AutocompleteService

thheller07:09:40

(new js/google.maps.places.AutocompleteService) is also fine

itaied07:09:45

(new js/google.maps.places.AutocompleteService) would have worked as well?

itaied07:09:50

great thanks, I see now

itaied07:09:57

it did work by the way! thanks

thheller07:09:02

(def ^js locations-service hints the locations-service as a JS object, but not the call that produces it

thheller07:09:15

how do you not get warnings for this?

thheller07:09:10

ha this indeed does not produce a warning

itaied07:09:15

shadow didnt give me a warning, but vs code (clj-kondo) did

itaied07:09:25

but only when i have opened the file

thheller07:09:26

weird, let me check that

thheller07:09:45

regardless, accessing global variables is done with the js/ prefix

🙌 1
thheller07:09:55

hehe because of the closure compiler having some default google externs shadow-cljs doesn't complain about anything starting with google. 😛

itaied07:09:47

ohh wow.. that's an edge case

itaied07:09:39

there's another weird behavior I experienced a few days back. Locally the release works, but building it via CI it breaks with:

Uncaught ReferenceError: shadow$bridge is not defined
    at main.js:684:61
    at main.js:3075:4
I have the same versions of java, clojure and node on the container, and the differences of main.js and libs.js are a few bytes. It's difficult to find the differences due to the sizes of the files. Do you have any idea what could cause it before I'm digging in randomly?

thheller07:09:26

shadow$bridge is the variable defined by the external output, so I guess thats not loaded correctly?

itaied07:09:03

It's the same code and executes. Only difference is running on my machine vs a container

thheller07:09:34

I don't know your CI setup, so how does that execute? I mean is it a full browser driven remotely or what does that do?

thheller07:09:49

just because there is the same files on disk, does not mean they are loaded the same way 😛

anovick07:09:41

Is shadow-cljs sufficient for everything I wish to do with CLJS-based web apps, to the degree that leiningen is not needed anymore? In other words, are there still things that leiningen can do for CLJS-based web apps, but shadow-cljs can't?

thheller07:09:33

depends, shadow-cljs only does the CLJS

thheller07:09:54

if you want a CLJ webserver or anything server side that is CLJ you likely want leiningen or deps.edn

thheller07:09:10

otherwise shadow-cljs covers everything CLJS and does not need leiningen

anovick07:09:46

That's great to hear 🙂

hifumi12317:09:06

FWIW at work we use shadow-cljs "by itself", no leiningen or deps.edn For a simple reason: the shadow-cljs release from npm provides everything we need out of the box. The built-in web server with live reloading CSS is pretty useful (in addition to shadow's cljs reloading)

Jakub Holý (HolyJak)11:09:38

Hello! When I use my app with :optimizations :none (w/ watch) or :simple (w/ release) then it works, but if I change the latter to :whitespace and load the code, it fails with > TypeError: goog is undefined Why could that be, and how to fix it? Could it be that e.g. some macro is checking for dev vs prod mode, and tries to use goog b/c it incorrectly concludes this is dev mode? 🙏 (Using shadow-cljs 2.25.6, which pulls in google-closure-library 0.0-20230227-c7c0a541 and org.clojure/clojurescript 1.11.60)

Jakub Holý (HolyJak)11:09:55

it is the goog.provide in

...

      E.parser = qa // this seems to come from CodeMirror
    };
    'use strict';
    goog.provide('goog.events.EventWrapper');
    goog.provide('goog.events.EventLike');
    goog.provide('goog.debug.ErrorHandler'); /*

 Copyright The Closure Library Authors.
 SPDX-License-Identifier: Apache-2.0
*/
    var CLOSURE_NO_DEPS = true;
    var CLOSURE_BASE_PATH = 'js/cljs-runtime/';
    var CLOSURE_DEFINES = {
      'goog.DEBUG': false,
...
The error happens at ☝️ line 37141, but a little later at 37157 there is var goog = goog || {} and at 37203 there is goog.provide = function ... . If the three goog.provide weren’t there, or were moved down by some 100 lines, it would likely work.

👀 1
borkdude11:09:20

version 2.25.7 is out, don't know if that helps

Jakub Holý (HolyJak)11:09:34

Sadly no, it doesn’t help.

borkdude11:09:05

and older versions of shadow-cljs? ;)

👀 1
Jakub Holý (HolyJak)12:09:27

Shadow 2.20.0 has the same problem

thheller12:09:14

why whitespace? that is pretty much an unsupported optimization option

👍 1
thheller12:09:59

whitespace literally means leave everything as is, remove whitespace

thheller12:09:04

so the code looks like dev code

Jakub Holý (HolyJak)12:09:22

I am trying to troubleshoot https://clojurians.slack.com/archives/C015LCR9MHD/p1695985193245379 - with :simple it does now work, but with :none it does. By “it” I mean the following shadow init fn:

(defn init []
  (println "Init run")
  (sci/eval-string* full-ctx "
    (do
      (ns test (:require 
        [com.fulcrologic.fulcro.dom :as dom]
        [com.fulcrologic.fulcro.application :as app]
        [com.fulcrologic.fulcro.components :as comp :refer [defsc]]))
      (defonce app2 (do (println \"Def app!\") (app/fulcro-app)))
      (comp/defsc Root [_ _] (dom/div (dom/h3 \"One\")))
      (app/mount! app2 Root \"app\"))
    ")
  
  (sci/eval-string* full-ctx "
    (do
      (ns test (:require 
        [com.fulcrologic.fulcro.dom :as dom]
        [com.fulcrologic.fulcro.application :as app]
        [com.fulcrologic.fulcro.components :as comp :refer [defsc]]))
      (defonce app2 (do (println \"Def app!\") (app/fulcro-app)))
      (comp/defsc Root [_ _] (dom/div (dom/h3 \"TWO\")))
      (app/mount! app2 Root \"app\"))
    ")
  )
In :none , the dom with show the heading with TWO but with :simple it will show One

borkdude12:09:21

(I already suggested release with --debug)

borkdude12:09:45

(I also suggested getting rid of asset-path)

borkdude12:09:20

Not sure if we should bug thheller with this @U0522TWDA

borkdude12:09:26

It doesn't seem to be a shadow problem to me

thheller12:09:28

what is the build config used?

Jakub Holý (HolyJak)12:09:31

currently

:builds   {:dev     {:compiler-options {:output-feature-set :es8
                                         :optimizations :simple
                                         :source-map true}
                      :target     :browser
                      :output-dir "www/js/dev"
                      ;:asset-path "/js/dev"
                      :modules    {:dev {:init-fn development/init}}
                      :devtools   {:after-load development/reload}}}
and building with (clojure "-M:test:dev:shadow-cli release dev --debug")

thheller12:09:50

try adding :output-wrapper false to the compiler options

1
Jakub Holý (HolyJak)13:09:36

I did, doesn’t seem to have any effect. Michiel suggested that in my SCI macro I must be emitting something which is prone to renaming. But simple only renames local vars and fn params, right? I wanted to try whitespace to be sure whether it is renaming or st. else causing the problem…

thheller13:09:41

yes, simple only renames locals. whitespace keeps all the other dev stuff, so it is not recommended or by my account supported

👍 1
thheller13:09:05

don't know what you are doing with SCI, so can't comment much

thheller13:09:22

the goog is undefined stuff usually means that something was eval'd in the wrong scope

Jakub Holý (HolyJak)13:09:32

Then I will look at the variables and params in the functions to see which one could it be…

thheller13:09:04

you also should keep :asset-path, don't know why @U04V15CAJ recommended to remove it?

👍 1
thheller13:09:32

it is a must have setting when it isnt /js

borkdude13:09:37

because I got rid of the goog is undefined warning when I removed it

thheller13:09:21

but there is a js/dev folder? so I'm assuming the JS is accessed via /js/dev/dev.js

borkdude13:09:22

so I figured it was one less mis-configuration to worry about (in addition to the simple stuff which I know isn't support in shadow)

borkdude13:09:34

I just got rid of that dev indirection

borkdude13:09:10

This is my config which works:

{:deps     {:aliases [:test :dev]}
 :nrepl    {:port 9000}
 :dev-http {8081 "www"}
 :builds   {:dev     {#_#_:compiler-options {:output-feature-set :es8
                                         :optimizations :none #_whitespace}
                      :target     :browser
                      :output-dir "www/js"
                      #_#_:asset-path "/js/dev"
                      :modules    {:dev {:init-fn development/init}}
                      :devtools   {:after-load development/reload}}}}
<script src="js/dev.js" type="text/javascript"></script>

thheller13:09:29

yes, this is using /js as the output folder, then the :asset-path "/js" default is correct. in the above config it was not. :asset-path "/js/dev" in your config would have been incorrect

thheller13:09:58

:asset-path is basically "path to the folder where the .js files are"

borkdude13:09:20

I just wanted to go with the defaults, not to conflate the issue any further. can add those asset path stuff back in later

thheller13:09:22

needed in development for things like source maps in some circumstances

Jakub Holý (HolyJak)13:09:23

FYI Michiel figured out that if we modify the script by renaming Root to Root2 in the second eval call, then it will work and correctly show the second app. So it looks like we can define & mount new classes, but not change existing ones, somehow, when optimizations are on. I need to dig into it…

thheller13:09:54

what is the point of rendering something and then immediately rendering over it?

borkdude13:09:58

as I already told, this is likely not a shadow issue ;)

Jakub Holý (HolyJak)13:09:58

Well, the whole adventure started with https://blog.jakubholy.net/2023/interactive-code-snipets-fulcro/#_demo - the point is having a code editor in a web page, and being able to change the code, reeval, and see the output change. The last part - seeing the effect - is broken with optimizations right now.

borkdude13:09:19

localhost...

thheller13:09:30

hehe yeah, no clue what that is 😛

borkdude13:09:36

"snipets" you might want to correct that to "snippets" (very minor thing ;))

🙏 1
thheller13:09:26

ERROR: Could not resolve symbol: js/console.log does sci not know this?

borkdude13:09:51

yes, it has to be configured for it, which Jakub hasn't done yet

Jakub Holý (HolyJak)13:09:00

Let me release a new version, which exposes it

thheller13:09:15

my guess is somehow that Root is not overwritten

thheller13:09:36

if I name it to Root2 and change the mount arg accordingly it renders the "new" code fine

thheller13:09:30

could be the defsc macro? 😛

Jakub Holý (HolyJak)13:09:36

The problem is that for the editor to be really useful, I need to be able to change existing code/components 😭

Jakub Holý (HolyJak)13:09:03

The defsc macro is something I had to rewrite into a SCI fn so most likely I do st. wrong there…

borkdude13:09:52

perhaps a defonce or so somewhere

thheller13:09:23

serems to be the defsc macro, if I use defn it works fine

borkdude13:09:00

(defonce ~(vary-meta sym assoc :doc doc :jsdoc ["@constructor"])
                    (comp/react-constructor (get options# :initLocalState)))

Jakub Holý (HolyJak)13:09:08

Thank you both ♾️ times! I will dig into the macro-fn thingy…

borkdude13:09:26

when I change the defonce in the defsc macro to def it starts to work

borkdude13:09:52

not sure why it did "work" under non-advanced compilation though

borkdude13:09:43

that would still be interesting to find out imo

thheller13:09:42

but that should have meant that :release works and watch/compile doesn't?

thheller13:09:00

ah nvm .. its not shadow-cljs doing the compilation so this has no effect whatsoever 😛

borkdude13:09:37

yeahs, it's defonce in SCI ;)

Jakub Holý (HolyJak)13:09:07

Thank you both so much, for spending your valuable time to help me out! I couldn’t do this on my own. Thank you, and have a great weekend!

borkdude13:09:06

Jakub:, when I add back the defonce:

(defonce ~(vary-meta sym assoc :doc doc :jsdoc ["@constructor"])
             (do
               (prn :redefine)
               (comp/react-constructor (get options# :initLocalState))))
in non-advanced I do get to the the second component, although I see only once redefine printed. So there may be a bug elsewhere. Shall we take it back to the SCI channel, unless Thomas is interested in following? ;)

👍 1
Jakub Holý (HolyJak)13:09:00

Thank you! Yes, let’s do that. I have to leave now to arrange stuff, but will get back to it in the evening.

borkdude14:09:17

using --debug output and rendering the same code through the normal CLJS compiler, I get:

var $options__47309__auto___58136$$ = new $cljs$core$PersistentArrayMap$$(null, 1, [$cljs$cst$2826$render$$, function($_$jscomp$693$$) {
  return $com$fulcrologic$fulcro$components$wrapped_render$$($_$jscomp$693$$, function() {
    $com$fulcrologic$fulcro$raw$components$props$$.$cljs$core$IFn$_invoke$arity$1$ ? $com$fulcrologic$fulcro$raw$components$props$$.$cljs$core$IFn$_invoke$arity$1$($_$jscomp$693$$) : $com$fulcrologic$fulcro$raw$components$props$$.call(null, $_$jscomp$693$$);
    return $com$fulcrologic$fulcro$dom$macro_create_element$$.$cljs$core$IFn$_invoke$arity$3$("div", new $cljs$core$PersistentVector$$(null, 1, 5, $cljs$core$PersistentVector$EMPTY_NODE$$, [$com$fulcrologic$fulcro$dom$macro_create_element_STAR_$$(["h3", {}, "One"])], null), null);
  });
}], null), $development$Root$$ = $com$fulcrologic$fulcro$components$react_constructor$$($cljs$core$get$$.$cljs$core$IFn$_invoke$arity$2$($options__47309__auto___58136$$, $cljs$cst$2816$initLocalState$$));
$com$fulcrologic$fulcro$components$configure_component_BANG_$$($development$Root$$, $cljs$cst$5218$development_SLASH_Root$$, $options__47309__auto___58136$$);
$cljs$core$prn$$.$cljs$core$IFn$_invoke$arity$variadic$($cljs$core$prim_seq$cljs$0core$0IFn$0_invoke$0arity$02$$([$development$Root$$]));
$com$fulcrologic$fulcro$application$mount_BANG_$$.$cljs$core$IFn$_invoke$arity$3$($development$app2$$, $development$Root$$, "app");
var $options__47309__auto___58137$$ = new $cljs$core$PersistentArrayMap$$(null, 1, [$cljs$cst$2826$render$$, function($_$jscomp$694$$) {
  return $com$fulcrologic$fulcro$components$wrapped_render$$($_$jscomp$694$$, function() {
    $com$fulcrologic$fulcro$raw$components$props$$.$cljs$core$IFn$_invoke$arity$1$ ? $com$fulcrologic$fulcro$raw$components$props$$.$cljs$core$IFn$_invoke$arity$1$($_$jscomp$694$$) : $com$fulcrologic$fulcro$raw$components$props$$.call(null, $_$jscomp$694$$);
    return $com$fulcrologic$fulcro$dom$macro_create_element$$.$cljs$core$IFn$_invoke$arity$3$("div", new $cljs$core$PersistentVector$$(null, 1, 5, $cljs$core$PersistentVector$EMPTY_NODE$$, [$com$fulcrologic$fulcro$dom$macro_create_element_STAR_$$(["h3", {}, "TWO"])], null), null);
  });
}], null);
$development$Root$$ = $com$fulcrologic$fulcro$components$react_constructor$$($cljs$core$get$$.$cljs$core$IFn$_invoke$arity$2$($options__47309__auto___58137$$, $cljs$cst$2816$initLocalState$$));
Note that we see $development$Root$$ = twice which means Root is getting initialized twice. It seems defonce is behaving a bit different in normal CLJS then which may explain the difference?

borkdude14:09:11

which is probably due to CLJS hacks in shadow:

release builds will never overwrite a defonce, skip DCE-unfriendly verbose code

borkdude14:09:46

still a mystery why there is a difference between dev and release with SCI but I'm willing to let this detail slide now

borkdude14:09:38

although I don't get the comment in shadow: isn't it the case that a defonce is always redefined, instead of "never overwrite"?

thheller14:09:13

there is never a cause where a defonce is executed twice basically

thheller14:09:20

defonce exists because of the repl/hot-reload

thheller14:09:48

release builds don't do either, so you don't need defonce

borkdude14:09:02

ah right :)

borkdude14:09:21

unless you re-define a var twice like:

(def x 1)
(defonce x 2)

borkdude14:09:32

which is what happens in the above example

borkdude14:09:36

but typically you don't do this

thheller14:09:10

that should give a warning yes

borkdude14:09:58

from both CLJS and clj-kondo if somebody's using that as well ;)

Jakub Holý (HolyJak)14:09:42

I shall henceforth address you as Mr. Holmes :sleuth_or_spy: :-)

😆 1
jpmonettas13:09:52

hi! Is there a way of forcing an entire recompilation of my cljs project from shadow-ui, cljs repl or clj repl? even when no cljs file has been modified

thheller13:09:43

you mean without cache?

jpmonettas13:09:24

yeah, so, recompiling all my files, same as when I restart the watch

thheller13:09:37

restarting the watch will load the caches?

thheller13:09:10

and no there is no setting to not use the cache

thheller13:09:27

but you can rm -rf .shadow-cljs/builds/the-build-id and then trigger a compile

thheller13:09:57

need to restart the watch if its running, since that has the in memory data still

jpmonettas13:09:46

I'm not sure about how the cache plays here, I was looking for a way of recompiling an entire project without restarting the watch, but that is independent of cljs files being modified or not

thheller13:09:22

the reason I'm talking about cache is that there will no no compilation happening if no files were modified

👍 1
thheller13:09:29

because the cache is used instead

jpmonettas13:09:41

when I click the Force Recompile of my build in the UI it returns immediately and doesn't recompile

thheller13:09:17

yes, thats mostly there to trigger a hot-reload cycle. with no actual code compilation, besides "always compile" files

thheller13:09:50

why do you want this?

jpmonettas13:09:30

so I have this dev compiler, ClojureScriptStorm, which is a fork of the cljs compiler that adds automatic instrumentation when it compiles anything. You can change what ns get instrumented by changing a clj var. So lets say I want to change what gets instrumented, I can change that var, but then I need to recompile everything, to bring the new instrumented/uninstrumented code the browser

jpmonettas13:09:00

does it make sense?

thheller13:09:58

maybe you want to turn of caching entirely for that case? https://shadow-cljs.github.io/docs/UsersGuide.html#_compiler_cache

thheller13:09:17

so shadow-cljs is still doing the compilation, just not using actual cljs.analyzer anymore? is that right?

jpmonettas14:09:13

interesting, I guess I can try cache-level :jar, which will always recompile my app but no other lib?

jpmonettas14:09:30

like some middle ground

jpmonettas14:09:13

or maybe leave normal cache an run a shell command that touches every cljs file? so it will force a full recompilation?

thheller14:09:34

those are all the options that cause the cache to be invalidated and recompiled

thheller14:09:57

I guess you could use [:compiler-options :tooling-config] or :external-config? or however is all is controlled?

jpmonettas14:09:20

sorry, not sure I follow, you mean changing one of those in my shadow-cljs.edn will fire a full recompilation?

thheller14:09:41

well, need to restart the watch

thheller14:09:51

I guess I'm not really sure how this all works from your end

jpmonettas14:09:21

so, what I'm looking for is a way of recompiling all without restarting the watch. The compiler will emit different output depending on the contents of a global var (clj land). So I can go and change that var from the clj repl, but then I would like to re-compile all my app so I get the newly compiled code. Since this is a dev tool I would like to do all this interactively, as part of your dev flow, that is why I don't want to restart anything

thheller14:09:28

recompile everything is a bit tricky, as reloading cljs.core for example is not safe

thheller14:09:59

also reloading any of the shadow.cljs.devtools things will cause a reconnect, which may confuse the REPL

thheller14:09:14

so you likely want to limit that to project files

jpmonettas14:09:29

yeah, got it, I was looking for recompiling my app stuff only

thheller14:09:20

I can give you shadow-cljs specifc way of doing this, that basically abuses the hot-reload mechanism?

jpmonettas14:09:46

I think this made the trick find src -name "*cljs" -exec touch {} +

thheller14:09:34

the main issue is that shadow-cljs is not aware of your CLJ var doing stuff to the compilation

thheller14:09:42

so it just ignores it when it comes to cache

jpmonettas14:09:45

but that find command did exactly what I need

jpmonettas14:09:06

so hacky as it gets but is an easy way of forcing only your app recompilation with one command

thheller14:09:27

yes, I'm just warning you about caching issues

jpmonettas14:09:18

what do you think could go wrong with touching all my cljs files and make shadow recompile them?

thheller14:09:38

the compiler is not aware of what is in your tool settings

thheller14:09:42

so say you compile once

thheller14:09:53

restart shadow-cljs and it'll think the cache is good

thheller14:09:57

but your app settings are gone

thheller14:09:10

so maybe things are broken

jpmonettas14:09:31

I mean, this compiler is aware, because is a fork of the ClojureScript compiler, which looks at those vars when emitting code

thheller14:09:45

I mean shadow-cljs when I say compiler

jpmonettas14:09:00

but shadow-cljs is just calling the current cljs compiler

jpmonettas14:09:12

in this case ClojureScriptStorm

thheller14:09:21

that is not at all what I mean

thheller14:09:41

shadow-cljs when starting a build decides whether it can use the cache for a file or whether it needs to recompile

thheller14:09:46

it has no concept of what your tool is

thheller14:09:01

so it will likely skip compilation entirely and use the cache

thheller14:09:14

but the cached code still had all your old tool settings

thheller14:09:27

so now things may blow up since those settings don't really exist anymore

thheller14:09:44

but again ... I don't know what you are doing .. so this is just a general warning about cache. there be dragons.

jpmonettas14:09:35

so, the only thing I'm doing is that I'm swapping the official Cljs compiler, by a fork that just emits some extra code when emitting js, that is it, think of like adding js/console.logs everywhere, no other magic. I understand that shadow-cljs will cache the compiled output, but if I have a simple way of touching every cljs file under my project, I can fire that whenever I want to be sure that everything is being recompiled

thheller14:09:34

again .. just a warning. its always weird to have "only works after I do this" behavior

thheller14:09:58

should be fine but you are messing with shadow-cljs in ways it doesn't like to be messed with 😛

😅 1
jpmonettas14:09:31

but you mean by running a touch on all cljs files?

jpmonettas14:09:52

I don't think it isn't messing with it in any other way

thheller14:09:28

you are changing the cljs.analyzer and compiler under the hood, so I'd say that qualifies as messing with it 😉

thheller14:09:49

but if you are careful everything should be fine. I'll just direct users your way if they run into problems 😉

jpmonettas14:09:14

well, yeah, BUT since shadow-cljs support is my main concern, all I'm touching is always after I'm sure it works with shadow-cljs

jpmonettas14:09:43

so, you can think of it as a shadow-cljs plugin thing at the compiler level

jpmonettas14:09:25

I'm aware of the shadow hacks ns, and stuff like that, so I'm designing the compiler with that in mind, and works great so far

jpmonettas14:09:19

> I'll just direct users your way if they run into problems 😉 hahah yeah, of course, I mean, is a thing with this dev compilers, same thing with ClojureStorm, I don't want people to go complaining with the Clojure team for a dev compiler error, but since swapping compilers is a keyword away, is very easy to know if an error is coming from the dev compiler or the original one

jpmonettas14:09:21

anyway, thanks for your time!

jpmonettas13:09:55

and is there a way of jumping that cache from the clj repl? some shadow fns?

thheller13:09:21

(clojure.java.shell/sh "rm" ...) I guess?