Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I pass Closure Compiler options to r.js in command line? #128

Closed
disolovyov opened this issue Mar 15, 2012 · 2 comments
Closed

How can I pass Closure Compiler options to r.js in command line? #128

disolovyov opened this issue Mar 15, 2012 · 2 comments
Milestone

Comments

@disolovyov
Copy link

Hi!

I looked at the example build.js file and there's a section for Closure called CompilerOptions, but no examples how to set anything in it (just an empty object).

Tried passing an argument like closure.CompilerOptions.languageIn=ECMASCRIPT5_STRICT to r.js in command line, but that doesn't work. And it probably makes no sense?

Is there a way to pass such an option? Specifically, tell r.js to tell closure to keep 'use strict'; directives.

Thanks.

@jrburke
Copy link
Member

jrburke commented Mar 26, 2012

Ah, so this looks like a limitation in the conversion of command line args into a JS object. If you use a build file, similar in structure to the example build.js, and then do something like this:

{
    closure: {
      CompilerOptions: {
        languageIn: 'ECMASCRIPT5_STRICT'
    }
}

then I expect that to work. Also note that r.js will try to strip out use strict calls unless useStrict: true is set:
https://github.com/jrburke/r.js/blob/master/build/example.build.js#L118

I'll target this ticket for 1.1 to fix the nested property conversion from the command line. Feel free to also leave a comment if the above build file workaround approach does not work.

@balee
Copy link

balee commented Jul 17, 2019

It is a bit old, but the workaround approach does not work in v2.3.6:
java.lang.ClassCastException: Cannot cast java.lang.String to com.google.javascript.jscomp.CompilerOptions$LanguageMode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants