Undefined nameToPath for bootstrap` when using Twitter's Bootstrap (twbs)

Description

How to reproduce problem

src/cljsbuild_bootstrap4/core.cljs

index.html

build.clj

  1. Copy the 1.9.946 cljs.jar to the current working directory

  2. Run

  3. open index.html

  4. Observe console messages.

Expected result

  1. Console should show the following messages:

  2. The Bootstrap Alert component should fade from the page resulting in a blank page.

  3. Compiler should produce:

    out/cljs_deps.js

Actual result

  1. Console shows

  2. The Bootstrap Alert component fails to fade from the page and remains on the page.

  3. Compiler produces:

    out/cljs_deps.js

Environment

1.9.946

Activity

Show:

Mike FikesMay 19, 2018 at 10:22 PM

Ahh I see what is going on. This is a problem with 1.9.946. No longer reproducible with 1.10.238.

Mike FikesMay 19, 2018 at 10:08 PM

Corin, I can't repro. I've also updated the description so that anyone can attempt to repro. (Minimal per https://clojurescript.org/community/reporting-issues)

I get a slightly different out/cljs_deps.js (below), but otherwise, I get the expected behavior as per the ticket description.

out/cljs_deps.js

importJanuary 8, 2018 at 8:03 AM

Comment made by: derekchiang

Getting the same error for `ethereumjs-abi` too.

Log from console:

```
base.js:1357 Uncaught Error: Undefined nameToPath for ethereumjs_abi
at visitNode (base.js:1357)
at visitNode (base.js:1355)
at visitNode (base.js:1355)
at Object.goog.writeScripts_ (base.js:1369)
at Object.goog.require (base.js:706)
at (index):46
```

poernahiSeptember 29, 2017 at 9:31 AM

I am also getting the same error when trying to use 'apollo-client'. 'cljs_deps.js' would be missing the 'whatwg-fetch' dependency.

I suspect this is because 'whatwg-fetch' is a polyfill that does not explicitly export anything. I was able to workaround the issue by appending the following lines to the bottom of '<projectdir>/node_modules/whatwg-fetch/fetch.js'

const whatwg_fetch = 1;
export { whatwg_fetch };

I don't know enough to say that this is the same problem, other than the error message being identical. I have not tried adding the same hack to bootstrap.js

poernahiSeptember 29, 2017 at 1:44 AM

I came across the same problem and did some tracing. It looks like 'load-foreign-library' correctly populated the 'provides' key, but 'library-graph-node' failed to get the 'provides'. I also observed that the output of library-graph-node is the one that gets passed to cljs_deps.js

load-foreign-library: /Users/Hendrik/Projects/bugreports/cljsbuild-bootstrap4/node_modules/bootstrap/dist/js/bootstrap.js
provides: ["bootstrap" "bootstrap/dist/js/bootstrap.js" "bootstrap/dist/js/bootstrap"]

load-foreign-library: /Users/Hendrik/Projects/bugreports/cljsbuild-bootstrap4/node_modules/bootstrap/package.json
provides: []

Copying file:/Users/Hendrik/Projects/bugreports/cljsbuild-bootstrap4/node_modules/bootstrap/dist/js/bootstrap.js to out/node_modules/bootstrap/dist/js/bootstrap.js

load-library: out/node_modules/bootstrap/dist/js/bootstrap.js

library-graph-node: /Users/Hendrik/Projects/bugreports/cljsbuild-bootstrap4/out/node_modules/bootstrap/dist/js/bootstrap.js
{:requires [], rovides [],
:url #object[java.net.URL 0x6a0659ac "file:/<snip>/cljsbuild-bootstrap4/out/node_modules/bootstrap/dist/js/bootstrap.js"],
:closure-lib true, :lib-path "out/node_modules/bootstrap/dist/js/bootstrap.js"}

Not Reproducible

Details

Assignee

Reporter

Labels

Priority

Created September 24, 2017 at 9:13 AM
Updated May 19, 2018 at 10:28 PM
Resolved May 19, 2018 at 10:28 PM