Fork me on GitHub
#figwheel-main
<
2020-11-09
>
paulbutcher11:11:58

I would appreciate help debugging a js interop issue I’m having. I’m clearly misunderstanding something pretty basic. I am using the Vega library within my app. I’m compiling with Figwheel Main with NPM via :auto-bundle. Everything works just fine in dev, but I get an error in my production build when calling Vega methods. Vega is in my package.json and I’m importing it into my ClojureScript source with: [vega :refer [parse View]] . The code that causes the problem is:

(let [view (View. (parse (clj->js spec)) #js {:container (dom-node this)})]
        (.runAsync view)))
Creating a View object and calling the parse function both work fine, but when I try to call the runAsync method on the view, I get an error suggesting that advanced optimisations have chose to rename it. Everything works just fine if I switch the last line to:
(js-invoke view "runAsync")))
Clearly I’m missing something I should be doing to tell the Closure compiler to leave the name of runAsync alone, but I’ve no idea what that might be?