Fork me on GitHub
#shadow-cljs
<
2020-04-06
>
Oz02:04:48

A small question, I've installed a package on my project (vega-lite) using npm install some time ago. today I ran "npm install vega-lite" again, to get a new version. However, when I run shadow-cljs, it still uses the old version. How do I make it use the new version?

Oz02:04:17

I tried removing the package, and shadow-cljs noticed it's missing, but when re-installing it it still seems to compile the old version somehow

thheller08:04:55

@ozfraier shadow-cljs should be using whatever is at node_modules/vega-lite. so make sure that is actually the version you want.

Oz13:04:24

On node modules, the version in package.json is 4.9.0, But looking at the source in chromium development tools, it shows a file that starts with:

shadow$provide["module$node_modules$vega_lite$build$vega_lite"] = function(global,require,module,exports) {
var Buffer = require('buffer').Buffer;
(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
    typeof define === 'function' && define.amd ? define(['exports'], factory) :
    (global = global || self, factory(global.vegaLite = {}));
}(this, (function (exports) { 'use strict';

    var name = "vega-lite";
    var author = "Dominik Moritz, Kanit \"Ham\" Wongsuphasawat, Arvind Satyanarayan, Jeffrey Heer";
    var version = "4.2.0";
    var collaborators = [
    	"Kanit Wongsuphasawat ()",
    	"Dominik Moritz ()",
    	"Arvind Satyanarayan ()",
    	"Jeffrey Heer ()"
    ];
etc...
At the address http://js/compiled/cljs-runtime/node_modules/vega-lite/build/vega-lite.js Which is maybe derived from ./resources/public/js/compiled/cljs-runtime/module\$node_modules\$vega_lite\$build\$vega_lite.js (which states the version as 4.2.0) I grepped the project, and this is the only vega-lite + 4.2.0 mention I found. Also, an error message says that the version running is 4.2.0. I wonder what may cause it.

thheller13:04:52

well did you look at that actual file?

thheller13:04:36

it wouldn't be the first time that package.json contains a different version than some constant in the code

thheller13:04:10

but other than that did you restart after updating node_modules?

thheller13:04:20

sometimes the cache seems to get confused and miss an update if too many files change

thheller13:04:24

restart should fix it

thheller13:04:39

and are you sure you are in the correct folder?

thheller13:04:50

also common source of error ...

thheller13:04:06

<project>/node_modules/vega-lite assuming you didn't overwrite any path related stuff in your config

Oz15:04:45

Restarting didn't work, Hmm, I checked the actual file <project>/node_modules/vega-lite/build/vega-lite.js and it has version 4.9.0. Made sure I'm in the right folder.. Maybe the shadow-cljs.edn config can help?

{:lein   true
 :nrepl  {:port 8777}
 :builds {
          :app          {:target     :browser
                         :output-dir "resources/public/js/compiled"
                         :asset-path "/js/compiled"
                         :modules    {:app {:init-fn  crystal-web-client.core/init
                                            :preloads [devtools.preload
                                                       day8.re-frame-10x.preload]}}
                         :dev        {:compiler-options {:closure-defines {re-frame.trace.trace-enabled?        true
                                                                           day8.re-frame.tracing.trace-enabled? true}}}
                         :devtools   {:http-root "resources/public"
                                      :http-port 8280}
                         }

thheller15:04:50

you can try wiping the resources/public/js/compiled dir or the .shadow-cljs/builds cache dir

thheller15:04:06

but this is really basic cache invalidation and that should work fine

Oz15:04:27

Wiping .shadow-cljs/builds did the trick, many thanks!