Uploaded image for project: 'ClojureScript'
  1. CLJS-2737

No such file when using fs from ns form

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not Reproducible
    • Affects versions: 1.10.238
    • Fix versions: None
    • Labels:
      None

      Description

      With a file like this:

      (ns cli-repro.core
        (:require fs))
      
      (enable-console-print!)
      
      (println "ls .:\n" (fs/lstatSync "."))
      

      And a cljsc.edn file like:

      {:main cli-repro.core
       :verbose true
       :optimizations :simple
       :target :nodejs}
      

      This fails:

      clojure -m "cljs.main" -v -co "cljsc.edn" -c cli-repro.core

      With:

      Caused by: clojure.lang.ExceptionInfo: No such namespace: fs, could not locate fs.cljs, fs.cljc, or JavaScript source providing "fs" in file /home/arichiardi/tmp/cli-repros/src/cli_repro/core.cljs {:tag :cljs/analysis-error}
      	at clojure.core$ex_info.invokeStatic(core.clj:4754)
      	at clojure.core$ex_info.invoke(core.clj:4754)
      	at cljs.analyzer$error.invokeStatic(analyzer.cljc:697)
      	at cljs.analyzer$error.invoke(analyzer.cljc:693)
      	at cljs.analyzer$error.invokeStatic(analyzer.cljc:695)
      	at cljs.analyzer$error.invoke(analyzer.cljc:693)
      	at cljs.analyzer$analyze_deps.invokeStatic(analyzer.cljc:2129)
      	at cljs.analyzer$analyze_deps.invoke(analyzer.cljc:2103)
      	at cljs.analyzer$ns_side_effects.invokeStatic(analyzer.cljc:3476)
      	at cljs.analyzer$ns_side_effects.invoke(analyzer.cljc:3471)
      	at cljs.analyzer$analyze_STAR_$fn__2510.invoke(analyzer.cljc:3596)
      	at clojure.lang.PersistentVector.reduce(PersistentVector.java:341)
      	at clojure.core$reduce.invokeStatic(core.clj:6762)
      	at clojure.core$reduce.invoke(core.clj:6745)
      	at cljs.analyzer$analyze_STAR_.invokeStatic(analyzer.cljc:3596)
      	at cljs.analyzer$analyze_STAR_.invoke(analyzer.cljc:3586)
      	at cljs.analyzer$analyze.invokeStatic(analyzer.cljc:3616)
      	at cljs.analyzer$analyze.invoke(analyzer.cljc:3598)
      	at cljs.compiler$emit_source.invokeStatic(compiler.cljc:1386)
      	at cljs.compiler$emit_source.invoke(compiler.cljc:1365)
      	at cljs.compiler$compile_file_STAR_$fn__3672.invoke(compiler.cljc:1467)
      	at cljs.compiler$with_core_cljs.invokeStatic(compiler.cljc:1285)
      	at cljs.compiler$with_core_cljs.invoke(compiler.cljc:1274)
      	at cljs.compiler$compile_file_STAR_.invokeStatic(compiler.cljc:1451)
      	at cljs.compiler$compile_file_STAR_.invoke(compiler.cljc:1444)
      	at cljs.compiler$compile_file$fn__3702.invoke(compiler.cljc:1547)
      	... 43 more
      

      Note that it works with js/require.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              arichiardi Andrea Richiardi
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: