GibboK
GibboK

Reputation: 73938

Is it possible to annotate JavaScript for the Closure Compiler adding @language ECMASCRIPT5?

I need to minificate some code using Google Compiler compiler.jar as part of a build process.

I have notice that by default the compiler is set to ES3 when I need instead setting the language to ES5.

At the moment I am trying to annotate my source code in order to fore ES5 using the following scripts.

Unfortunately @language is being ignored.

My question:


// ==ClosureCompiler==
    // @compilation_level SIMPLE_OPTIMIZATIONS
    // @language ECMASCRIPT5
    // ==/ClosureCompiler==


    define([
        'dojo/_base/declare',
        'dojo/topic'
    ], function (declare, topic) {
        'use strict';
        return declare('Message', null, {

            _test: 'default',
            get test() {
                return this._test;
            },
            set test(value) {
                this._test = value;
            },


            constructor: function (options) {

            }
        });
    });

Upvotes: 0

Views: 73

Answers (1)

Chad Killingsworth
Chad Killingsworth

Reputation: 14411

No language is not determined by annotations - but by compiler options (flags).

java -jar compiler.jar -O=SIMPLE --language_in=ECMASCRIPT5

I realize that the web service uses special annotations - but they are part of the special comment block at the top of the file. This is a special case and not used elsewhere.

Upvotes: 1

Related Questions