Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

201
Views
"ReferenceError: $jscomp is not defined" when changing output language spec by google-closure-compiler jar

I've downloaded the most recent version of compiler and i've tried to optimize js code with these flags:

java -jar closure-compiler-v20211006.jar -W VERBOSE -O WHITESPACE_ONLY --language_out ECMASCRIPT5 $script_path_in --js_output_file $script_path_tmp

closure compiler has optimized this lines of code:

for(var extraProperty of extraProperties){  
    option.setAttribute(extraProperty,initialOption[extraProperty]);    
}

into

for (var $jscomp$iter$0 = $jscomp.makeIterator(extraProperties), $jscomp$key$extraProperty = $jscomp$iter$0.next(); !$jscomp$key$extraProperty.done; $jscomp$key$extraProperty = $jscomp$iter$0.next()) {
        var extraProperty = $jscomp$key$extraProperty.value;
        {
            option.setAttribute(extraProperty, initialOption[extraProperty])
        }
    }

And as a result i receive such error in browser:

all_compressed.js Uncaught ReferenceError: $jscomp is not defined

Is there a way to change language spec with this compiler without adding side dependencies into the project, or maybe it's a bug?

Git bug tracker

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The best option for white space only mode is to set the language out to the latest ECMASCRIPT version used by the source code (or later) to avoid runtime dependencies.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!