figwheel-main

neumann 2022-02-15T23:21:06.687399Z

I'm trying to add an externs file to my project, and it doesn't seem to make any sort of difference. It's almost like the compiler doesn't even know about it.

neumann 2022-02-15T23:22:10.079889Z

This is my figwheel config:

^{:watch-dirs ["src/cljs" "test"]
  :auto-testing true
  :extra-main-files {:guide {:main guide.main}}
  :css-dirs ["target/public"]
  :npm {:bundles {"target/app.bundle.js" "src/js/index.js"}}
  :open-url false}
{:externs ["extra-externs.js"]
 :infer-externs true
 :main app.main
 :output-dir "target/public/cljs-out"
 :output-to "target/public/app.js"}

neumann 2022-02-15T23:23:38.326439Z

The "extra-externs.js" file is there with valid externs.

neumann 2022-02-15T23:33:21.825869Z

For example, if I add this code to my project:

(defn should-not-infer
  [^js/FooBar foo]
  (.someMethod foo 1 2 3))
And I have the following extra-externs.js file:
var FooBar;
FooBar.prototype.someMethod;
I still see the extern get generated in the inferred_externs.js file.

neumann 2022-02-15T23:36:33.448369Z

Essentially I'm asking: What's the recourse for this situation? If Google decided not to include a valid symbol, how does one avoid getting stuck with a warning?

neumann 2022-02-15T23:43:06.984569Z

There's definitely some issue. If I run this, the extern gets picked up just fine and no inferred extern gets generated:

clj -M --main cljs.main --compile-opts "figwheel.cljs.edn" --compile app.main

neumann 2022-02-15T23:52:32.531279Z

I should note that I am using the latest release of figwheel-main: 0.2.16