figwheel-main icon indicating copy to clipboard operation
figwheel-main copied to clipboard

Treat descendants of classpath dir as classpath

Open werenall opened this issue 4 years ago • 4 comments

Hello! Here in Magnet we noticed that figwheel complained about a path not being on classpath despite the that that it was held in resources/ that were added to resources path. Then we found the issue #221 that we believe is the same thing. We came up with this solution where we not only check for exact match in classpath but for any known classpath that is a (0, x) substring of the canonical path in question.

[Re #221]

werenall avatar Dec 04 '20 16:12 werenall

Sorry for not getting back sooner. I would need the specific complaint and situation. If its complaining about the target directory not being on the classpath. Then this solution won't work if you are using Figwheels server to serve your application. If you are using your own server then I would set :helpful-classpaths false so that these warnings will go away.

bhauman avatar Feb 11 '21 15:02 bhauman

You can use :helpful-classpaths false in your figwheel config to turn these helpers off.

bhauman avatar Feb 11 '21 15:02 bhauman

Hi @bhauman

thanks for looking into this. Unfortunately setting :helpful-classpaths to false turns the helpers off, but the warnings don't go away as you said.

Looking at https://github.com/bhauman/figwheel-main/blob/v0.213/src/figwheel/main.cljc#L2014-L2032 you can see that if the target directory is considered to be outside of the classpath and doesn't exist, then we get a warning whether :helpful-classpaths is true of false (a different warning in each case, but a warning nonetheless).

And looking at https://github.com/bhauman/figwheel-main/blob/v0.213/src/figwheel/main.cljc#L2035-L2046 something similar happens: either we get the warning from warn-that-dir-not-on-classpath if :helpful-classpaths is true, or we get the warning from lines 2041 to 2046.

iarenaza avatar Jun 08 '21 22:06 iarenaza

@iarenaza where would you like to go with this PR? It seems to me that the correct change is to suppress the warning when the flag is set to false? If so would you mind updating the PR to reflect this?

timothypratley avatar Apr 30 '22 19:04 timothypratley