Fork me on GitHub
#figwheel-main
<
2022-02-15
>
neumann23:02:06

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.

neumann23:02:10

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"}

neumann23:02:38

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

neumann23:02:21

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.

neumann23:02:33

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?

neumann23:02:06

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

neumann23:02:32

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