bhauman / lein-figwheel

Figwheel builds your ClojureScript code and hot loads it into the browser as you are coding!
Eclipse Public License 1.0
2.88k stars 210 forks source link

figwheel.main: Compiler warnings in emitted JavaScript #695

Closed mfikes closed 6 years ago

mfikes commented 6 years ago

This may be limited to source compiled from JARs when requiring at the REPL, but it is possible that Figwheel compiler warnings may end up in the emitted JavaScript (perhaps because of printing to stdout instead of stderr?)

Repro:

Set up a deps.edn:

{:deps {org.clojure/clojurescript {:mvn/version "1.10.238"}
        org.clojure/test.check {:mvn/version "0.10.0-alpha2"}
        metosin/spec-tools {:mvn/version "0.6.1"}
        com.bhauman/figwheel-main {:mvn/version "0.1.2"}}}

We will be using spec-tools simply because it will exhibit an undeclared var use warning on spec-tools.impl/resolve-form (this is unrelated to Figwheel, but needed to illustrate the failure scenario).

Now, startup a node REPL via

clj -m figwheel.main -t node -r

At the REPL prompt, evaluate

(require 'spec-tools.core)

Now exit the REPL and

cat target/node/figwheel-default-repl-build/spec_tools/core.js

If you scroll back a bit in the output, you will see that Figwheel compiler warning (ANSI-colorized) text is in the emitted JavaScript.

bhauman commented 6 years ago

Oh darn, yeah I know what's happening here. I'm traveling for the next 2 days so it might not get fixed until Monday.

Thanks for letting me know!

On Jun 15, 2018, at 5:14 AM, Mike Fikes notifications@github.com wrote:

This may be limited to source compiled from JARs when requiring at the REPL, but it is possible that Figwheel compiler warnings may end up in the emitted JavaScript (perhaps because of printing to stdout instead of stderr?)

Repro:

Set up a deps.edn:

{:deps {org.clojure/clojurescript {:mvn/version "1.10.238"} org.clojure/test.check {:mvn/version "0.10.0-alpha2"} metosin/spec-tools {:mvn/version "0.6.1"} com.bhauman/figwheel-main {:mvn/version "0.1.2"}}} We will be using spec-tools simply because it will exhibit an undeclared var use warning on spec-tools.impl/resolve-form (this is unrelated to Figwheel, but needed to illustrate the failure scenario).

Now, startup a node REPL via

clj -m figwheel.main -t node -r At the REPL prompt, evaluate

(require 'spec-tools.core) Now exit the REPL and

cat target/node/figwheel-default-repl-build/spec_tools/core.js If you scroll back a bit in the output, you will see that Figwheel compiler warning (ANSI-colorized) text is in the emitted JavaScript.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

bhauman commented 6 years ago

That commit should fix it for now, this may mess with rebel-readline though for REPL warnings.

bhauman commented 6 years ago

Yes this fixes the problem but the Warning output is getting swallowed in rebel-readline

mfikes commented 6 years ago

Thanks for fixing this Bruce. We are using the latest above as a Git Dep and will let you know if we see anything funky.

bhauman commented 6 years ago

Great! Thanks for the report!