ClojureScript

npm modules not inserted into cljs_deps when compiler is restarted

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: 1.10.238
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

When restarted, compiler would rewrite cljs_deps and remove all npm modules dependency. Problem only appears when rebuilding, not from clean compilation.

Workaround: Do a clean build every time compiler has to be restarted.

Minimal example: https://github.com/poernahi/cljsbuild_wrongdeps

Steps to reproduce using above example:
1. Copy/symlink clojurescript uberjar into project root as cljs.jar
2. make clean && make && wc -l out/cljs_deps.js # Should return 186 lines
3. touch src/cljsbuild_wrongdeps/core.cljs && make && wc -l out/cljs_deps.js # Now returns only 4 lines!!

I think this is related to CLJS-2339. I narrowed down to this line
https://github.com/clojure/clojurescript/commit/245bdee2c35e19a9685b7a0849f26fce8bdaf7ca#diff-84ffd22349e5ca1fe6322cb0e379b3b1R2250

When a new compiler instance is run, the cache in ::transitive-dep-set is empty and index-node-modules return nil.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: