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

Failure to load is-plain-object transitive npm dep

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects versions: None
    • Fix versions: None
    • Labels:
    • Environment:

      {:deps {org.clojure/clojurescript {:mvn/version "1.10.238"}}}

      Description

      The slate npm dep depends on is-plain-object but it can't be loaded. Start up a REPL with:

      clojure -m cljs.main -co '{:npm-deps {"react" "15.5.4" "react-dom" "15.5.4" "slate" "0.33.6" "immutable" "3.8.2"} :install-deps true :repl-verbose true}' -d out -r
      

      (Note, that in the above we are going with the default browser REPL; the problem doesn't occur if you specify -re node.)

      Then, after the REPL is up and running:

      cljs.user=> (require 'slate)
      load-namespace module$private$tmp$test-me$node-modules$slate$lib$slate-es , compiled: ((module$private$tmp$test-me$node-modules$slate$lib$slate-es))
      goog.addDependency("../node_modules/slate/lib/slate.es.js", ['module$private$tmp$test_me$node_modules$slate$lib$slate_es'], ['module$is_plain_object', 'module$immutable', 'module$slate_dev_logger', 'module$direction', 'module$esrever', 'module$debug', 'module$lodash$isEqual', 'module$lodash$mergeWith', 'module$slate_schema_violations', 'module$lodash$pick', 'module$lodash$omit', 'module$is_empty']);
      
      goog.require('module$private$tmp$test_me$node_modules$slate$lib$slate_es');
      null;
      
      "Error evaluating:" (require (quote slate)) :as "goog.require('module$private$tmp$test_me$node_modules$slate$lib$slate_es');\nnull;\n"
      Error: Undefined nameToPath for module$is_plain_object
      	 (out/goog/base.js:1357:26)
      	 (out/goog/base.js:1369:14)
      	 (out/goog/base.js:706:27)
      	 require (out/clojure/browser/repl.cljs:340:25)
      

      Note that it can't load module$is_plain_object, which is specified via

      goog.require("module$is_plain_object");
      

      inside of out/node_modules/slate/lib/slate.es.js.

      But, you can load that namespace directly:

      cljs.user=> (require 'is-plain-object)
      load-namespace module$private$tmp$test-me$node-modules$is-plain-object$index , compiled: ([module$private$tmp$test-me$node-modules$isobject$index] (module$private$tmp$test-me$node-modules$is-plain-object$index))
      goog.addDependency("../node_modules/isobject/index.js", ['module$private$tmp$test_me$node_modules$isobject$index'], []);
      goog.addDependency("../node_modules/is-plain-object/index.js", ['module$private$tmp$test_me$node_modules$is_plain_object$index'], ['module$private$tmp$test_me$node_modules$isobject$index']);
      
      goog.require('module$private$tmp$test_me$node_modules$is_plain_object$index');
      null;
      

      This appears to be the result of Closure failing to find the correct paths to the modules and simply emitting module$<symbol> instead of module$<path> for the goog.require.

        Attachments

          Activity

            People

            • Assignee:
              mfikes Mike Fikes
              Reporter:
              mfikes Mike Fikes
            • Votes:
              4 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: