<< Back to previous view

[CLJS-762] "goog.require could not find: cljs_gwt.css" since compiler generates wrong code Created: 06/Feb/14  Updated: 08/Feb/14  Resolved: 08/Feb/14

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Sergey Stupin Assignee: Unassigned
Resolution: Declined Votes: 0
Labels: None

[org.clojure/clojure "1.5.1"]
[org.clojure/clojurescript "0.0-2156"]

OSX 10.9.1
Chrome Version 32.0.1700.102


The project for which the problem occurred is here https://github.com/hsestupin/cljs-gwt.
Steps to reproduce the problem:
1) from one console: lein ring server
2) from other console: lein cljsbuild clean & lein cljsbuild auto dev
3) http://localhost:3000/ in Google Chrome with dev-tools console. There will be an error: "goog.require could not find: cljs_gwt.css"

It was happened because of cljs/cljs_gwt/core.cljs is beginning with lines

(ns cljs-gwt.core
  (:require [cljs-gwt.css :as css]))

And then ClojureScript compiler emits the following from previous 2 lines resources/public/js/cljs_gwt.js


instead of


therefore an error occurred. That's it.

Comment by Francis Avila [ 06/Feb/14 4:15 PM ]

There is no goog.provide("cljs_gwt.css") emitted because there is no file that provides that namespace. Your css.clj file is misnamed--it should be css.cljs, otherwise clojurescript won't see it. (Also it has unbalanced parens and an illegal set!, so it won't compile anyway.)

There are two minor issues that you did hit upon, though:

  • You should have gotten a compiler warning for the missing namespace. I'm not sure why you didn't.
  • The cljs compiler may emit the same goog.require multiple times. This doesn't harm anything and the google closure compiler will remove them all.
Comment by Sergey Stupin [ 06/Feb/14 5:00 PM ]

Thanks for explanation, it helps a lot.

Generated at Fri Jan 19 15:34:38 CST 2018 using JIRA 4.4#649-r158309.