Qwerp-Derp
Qwerp-Derp

Reputation: 487

"required namespace never provided" when ClojureScript file is in different folder

I have a basic Chestnut project folder, with the src/cljs folder set up like so:

cljweb
- algorithms
  - gen-prob.cljs
- core.cljs
- webpage.cljs

In gen-prob.cljs, I have this namespace:

(ns cljweb.algorithms.gen-prob)

And in webpage.cljs, I'm requiring gen-prob.cljs like so:

(ns cljweb.webpage
  (:require [cljweb.algorithms.gen-prob :as prob]))

This all seems correct, however when I compile it to Heroku (git push heroku master), I get this error:

remote:        SEVERE: /tmp/build_c25e7d304d366857019ddcc3f177f680/target/cljweb/webpage.js:7: 
ERROR - required "cljweb.algorithms.gen_prob" namespace never provided
remote:        goog.require('cljweb.algorithms.gen_prob');
remote:        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

When I open the Heroku app (heroku open), nothing is displayed, and I get the error:

Uncaught ReferenceError: cljweb is not defined

Here is the Heroku website:

murmuring-brook-22851.herokuapp.com

And you can clone it using:

$ heroku git:clone -a murmuring-brook-22851

And renaming the whole folder to cljweb.

Upvotes: 1

Views: 298

Answers (1)

Piotrek Bzdyl
Piotrek Bzdyl

Reputation: 13175

Dashes from namespace names need to be replaced with underscore in the file name. You need to change gen-prob.cljs filename to gen_prob.cljs as the error message suggests:

required "cljweb.algorithms.gen_prob" namespace never provided

Upvotes: 1

Related Questions