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

fw-main Allow empty folder instead of ::schema/has-cljs-source-files #698

Open lgrapenthin opened 6 years ago

lgrapenthin commented 6 years ago

When setting up new projects I set up folders like for cljc that are empty when I start figwheel. Would be nice if they were made possible.

bhauman commented 6 years ago

The ClojureScript compiler fails with a pretty mysterious error when it is provided a directory to compile that has no source files in it, I added this protection so that you know why. If you don't want to get this error then don't provide watch directories that have no source files in them.

If you are getting this error in a situation where you are not providing an empty directory as a watch directory please let me know.

bhauman commented 6 years ago

This would really need to be fixed in the compiler.

lgrapenthin commented 6 years ago

Actually I had to dig through the source code to understand that I got the error because of an empty folder.

The error message was not helpful in this case and would certainly misdirect a non-expert user. It said nothing about an empty folder or clj* files being required in a folder.

If this is a CLJS compiler bug/GIGO situation I'd prefer figwheel not to interfere or warn at most. Iac it would be helpful if the error message got improved.

bhauman commented 6 years ago

Actually, I don't know what error you received.

Did you get a spec error?

bhauman commented 6 years ago

The CLJS compiler error is just an NPE when trying to read the source.

lgrapenthin commented 6 years ago

It showed me the watch-dirs vector and highlighted the empty folder, mentioned the ::watch-dirs spec but didn't mention its emptiness being the problem.