Fork me on GitHub

Should closure-defines work in a cljsbuild build when target is nodejs?


In particular goog.DEBUG

Robert Nikander11:04:22

Is *ns* supposed to be in cljs?


at runtime no, at compile/macro time yes


When running CLJS tests for a project with varying versions ranging from 1.9.x-1.10.x and varying clj from 1.9 to 1.10 along with it, I’m running across this error:

SyntaxError: Invalid regular expression: range out of order in character class

  file:///My/path/to/my-project/target/js/simple.js:5467 in RegExp
TypeError: undefined is not an object (evaluating '')

Using compiler opts like:
{:main "my.test"
 :output-to "resources/public/js/simple.js"
 :output-dir "resources/public/js/out"
 :asset-path "js/out"
 :optimizations :none}
I know this is not a great repro, but has anyone seen an issue similar to this before? The reported line (5467) with the RegExp issue looks like it’s in the middle of the Google closure part of the compiled JS. I believe it is this line:
goog.i18n.bidi.htmlSkipReg_=/<[^>]*>|&[^;]+;/g;goog.i18n.bidi.stripHtmlIfNeeded_=function(str,opt_isStripNeeded){return opt_isStripNeeded?str.replace(goog.i18n.bidi.htmlSkipReg_,""):str};goog.i18n.bidi.rtlCharReg_=new RegExp("["+goog.i18n.bidi.rtlChars_+"]");goog.i18n.bidi.ltrCharReg_=new RegExp("["+goog.i18n.bidi.ltrChars_+"]");goog.i18n.bidi.hasAnyRtl=function(str,opt_isHtml){return goog.i18n.bidi.rtlCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(str,opt_isHtml))};goog.i18n.bidi.hasRtlChar=goog.i18n.bidi.hasAnyRtl;
And final note, when I use clj 1.7 and a later cljs 1.7.x I don’t see this problem. I know my version numbers and surrounding details are vague. I’m giving the high-level view to see if anything here looks like something someone else has encountered.


It may also be the case that this problem shows up only in running phantomjs tests. I haven’t determined that yet. If is the case though, it’s phantomjs 2.1 (the last that will be released). It could end up just being a phantomjs problem even. Perhaps something in this regex isn’t supported.


does using an alias for a keyword namespace in cljs require having an empty file with (ns


yes there's currently no way to alias without a namespace


getting a weird error in cljs 1.10.339 in closure’s i18n module with :optimizations :none via shadow-cljs:

Uncaught SyntaxError: Invalid regular expression: /[Ö'-Û¯Ûº-ࣿâ€�-��-�ï¬-ï·¿ï¹°-ﻼ]/: Range out of order in character class
which seems to be erroring on the line:
goog.i18n.bidi.rtlChars_ = "֑-ۯۺ-ࣿ‏\ud802-\ud803\ud83a-\ud83b" + "יִ-﷿ﹰ-ﻼ";
anyone seen anything like this before? kind of at a loss for how to debug or move forward


@mss likely a missing <meta charset="utf-8"> in your html <head>


that was exactly it. thanks for all the help. shadow has been pretty lovely to work with


Hi guys! I'm trying to update cljsjs/react-popper to the latest version. In order to do so I'm following the instructions at Right now I'm stuck at the 'Update externs' part. As a first step I'm trying to reproduce the current react-popper.ext.js before updating any versions, but seems I'm missing something. I'm using like this:

curl -O 
curl -O 
curl -O 
curl -O 
curl -O 

generate-extern -f react.production.min.js,react-dom.production.min.js,prop-types.js,popper.js,index.umd.js -n ReactPopper -o test-extern.js
But comparing the resulting file against react-popper.ext.js mine is missing some parts:
 * Extern for ReactPopper
 * Generated by 
var ReactPopper = {
  "Manager": function () {},
  "Popper": function () {},
  "Reference": function () {},
  "placements": {}
ReactPopper.Manager.prototype = {
  "forceUpdate": function () {},
  "isReactComponent": function () {},
  "render": function () {},
  "setState": function () {}
 * End Generated Extern for ReactPopper
Any idea what I'm doing wrong?


@mss @thheller That’s odd timing. This error reported about the Regular expression is nearly the same line I just mentioned today in my question here The line I pasted with the error included this new RegExp("["+goog.i18n.bidi.rtlChars_+"]") which is probably where the error comes up. And Thomas’s suggestion solved it.


I also was only seeing it on “newer” cljs versions (didn’t see it in 1.7, do see it in 1.9 & 1.10 that I’ve checked). Not sure why. I guess google closure updates introduced this (assuming, haven’t investigated that track).


So the good part though is, this solved my problem as well… 🎉

🙌 4

has anyone encountered this issue? generating debug apk undefined is not a valid argument for 'in' (evaluating 'StopIteration' in src code is here and i've used this steps to generate apk Does anyone have any insights? Btw app works on emulator perfectly

Jp Soares19:04:44

I would like some help to use cljs.analyzer in cljs. I can find good online resources for clojure but not clojurescript. My goal is to walk through the AST of all functions of a namespace. Would be nice to be able to use tools.analyzer.ast.query as I've seen Nicola Mometto mentioning that it's environment agnostic.