<< Back to previous view

[CLJS-510] Problems with :optimizations :whitespace & :output-wrapper true Created: 28/May/13  Updated: 14/Oct/14

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

Type: Defect Priority: Minor
Reporter: Aku Kotkavuo Assignee: Unassigned
Resolution: Unresolved Votes: 2
Labels: None
Environment:

OS X 10.8.3, Google Chrome 28



 Description   

When I have both output wrapper and :whitespace optimizations enabled, I get the following error when loading the produced output:

goog.provide("goog.string");
goog.provide("goog.string.Unicode");
goog.string.Unicode = {NBSP:"\u00a0"};
^- Uncaught TypeError: Cannot set property 'Unicode' of undefined

Any ideas on what is going wrong? The error disappears if I use :simple or :advanced optimizations or if I set :output-wrapper to false (combined with any optimization level).



 Comments   
Comment by Aku Kotkavuo [ 28/May/13 10:14 AM ]

ClojureScript version used is 0.0-1806.

Comment by Aku Kotkavuo [ 28/May/13 10:30 AM ]

I'm also seeing this:

GET http://localhost:7070/deps.js 404 (Not Found)
goog.writeScriptTag_
goog.importScript_
goog.importScript_(goog.basePath + "deps.js")

I have no idea what deps.js is, something related to Google Closure Compiler?

Comment by David Nolen [ 19/Nov/13 9:23 PM ]

Is this problem still present? Thanks.

Comment by Immo Heikkinen [ 11/Mar/14 3:59 AM ]

The problem is still present in clojurescript master. To reproduce, compile https://github.com/clojure/clojurescript/tree/master/samples/hello using

cljsc src {:output-wrapper true :optimizations :whitespace} > hello.js
Comment by Herwig Hochleitner [ 13/Oct/14 5:28 PM ]

I just saw this with [org.clojure/clojurescript "0.0-2371"]

The last line of the following, throws the error, when compiled with :output-wrapper

goog.provide("goog.string");
goog.provide("goog.string.Unicode");
goog.define("goog.string.DETECT_DOUBLE_ESCAPING", false);
goog.string.Unicode = {NBSP:"\u00a0"};

Notice how if fails right after providing goog.string, so it might be a bug with google closure.

Comment by Immo Heikkinen [ 14/Oct/14 12:10 AM ]

I noticed that if you move

var goog = goog || {};

outside the wrapper function, the problem goes away. Looks like tt's some kind of JavaScript scope issue.

Comment by David Nolen [ 14/Oct/14 5:22 AM ]

I suspect that the whitespace and output wrapper combination is not compatible. I'm inclined to close this one as it's a Closure limitation not a ClojureScript one. I would be open to an error when these two options are combined.

Generated at Mon Oct 20 06:38:49 CDT 2014 using JIRA 4.4#649-r158309.