Thanks for the response.

Are you sure? The page you link to says that "ECMAScript 6 is now 
officially supported as an input language for the Closure Compiler", and 
that the google closure parser "understands all ES6 features", specifically 
"transpilation of the following ES6 features... arrow functions... default 
parameters... template strings." Which are the three es6 features included 
in my simple JS file.

What's more, if you remove the :language-in :es6 from the compiler options, 
the compiler specifically prints an error:

ERROR - this language feature is only supported for ECMASCRIPT6 mode or 
better: arrow function. Use --language_in=ECMASCRIPT6 or ECMASCRIPT6_STRICT 
or higher to enable ES6 features.

All of this seems to suggest that the google closure compiler is indeed 
aware of, and able to parse es6, and that something else after 
transpilation is causing the optimization phases to be skipped.

Z.



On Thursday, November 16, 2017 at 11:30:55 AM UTC-5, [email protected] 
wrote:
>
> From the Closure repository 
> https://github.com/google/closure-compiler/wiki/ECMAScript6 I get that 
> "Optimizations currently occur on "transpiled" code." 
> So you probably need to transpile your javascript first (using babel 
> https://babeljs.io/ for instance)
>
> Le jeudi 16 novembre 2017 02:33:31 UTC+1, Zalan Kemenczy a écrit :
>>
>> I'm trying to compile a super simple es6 JS file as a foreign lib, as 
>> described in the clojurescript docs under Bundling "Google Closure 
>> Compatible Code": 
>> https://clojurescript.org/reference/dependencies#bundling-javascript-code
>>
>>
>> The compilation succeeds with no optimizations. However, for the life of 
>> me I can't get it to compile with advanced optimizations. I just get a 
>> bunch of warnings, that say all the compiler phases were skipped. A lot of 
>> warnings like:
>>
>>
>> WARNING: Skipping pass checkVariableReferences
>>
>> factory features:  [block function, getters, string continuation, 
>> trailing comma, setters, ES3 keywor
>>
>> ds as identifiers, reserved words as properties, RegExp flag 'y', array 
>> pattern rest, binary literal,
>>
>>  let declaration, computed property, super, spread expression, RegExp 
>> flag 'u', default parameter, cl
>>
>> ass, arrow function, generator, template literal, for-of loop, member 
>> declaration, destructuring, oct
>>
>> al literal, const declaration, extended object literal, rest parameter, 
>> new.target, exponent operator
>>
>>  (**), trailing comma in param list, async function]    
>>
>>
>> The JS file looks like:
>>
>>
>> goog.provide('js.lib');
>>
>>
>> js.lib.debugMessage = (x = "any old string") => {
>>
>> console.log(`Printing ${x} from cljs!`);
>>
>> };
>>
>>
>> The cljs file looks like:
>>
>>
>> (ns integrated.core
>>
>>   (:require [js.lib :as lib]))
>>
>>
>> (enable-console-print!)
>>
>>
>> (lib/debugMessage "Narf")
>>
>>
>> and using the standalone cljs.jar, my build.clj file is:
>>
>>
>> (require 'cljs.build.api)
>>
>>
>> (cljs.build.api/build "src"
>>
>>     {:main 'integrated.core
>>
>>      :output-to "out/main.js"
>>
>>      :language-in :es6
>>
>>      :foreign-libs [{:file "src"
>>
>>                      :module-type :es6}]
>>
>>      :optimizations :advanced
>>
>>      :verbose true})
>>
>> If this is not how it's done, how do folks get es6 js to load as a 
>> foreign lib?
>>
>
>

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/clojurescript.

Reply via email to