Closed yuki-takei closed 8 years ago
hey @yuki-takei
i tried to reproduce it but i really cant
I created https://github.com/peh/babel-test-app which should be what you did. running grails war
or gradle assetCompile
works just fine and the resulting application.js is minified es5 code (without doing anything else then enabling the plugin)
the only difference (although it should really not be an issue) is that i enabled it in application.yml but this should make no difference as it is enabled by default...
PS: i made you a collaborator of the test repo so you can push a reproducable test case... PPS: thank you for reporting all those issues in such a nice way.
regarding your third question: actually thats what you would do in a node project too so i would say it is the ideal way.
@peh Thank you for prepare the repos for testing. Thanks to that I'm able to understand in detail the current situation.
Fist, I'm sorry, 'How to reproduce?' I wrote was not correct. It doesn't happen by 'example.es6' but 'example.es6.js'.
When you run gradle assetCompile
,
*.js
is not transpiled despite grails.asset.babel.processJsFiles = true
.*.es6
end up being transpiled despite grails.asset.babel.enabled = false
.So it seems that grails.asset.babel...
settings doesn't work when we run gradle assetCompile
.
my findings so far:
for gradle assetCompile
he cannot know any grails application specific configuration thats why there is a special assets block in build.gradle
there you can do:
assets { minifyJs = false minifyCss = false configOptions = [babel: [enabled: true, processJsFiles: true]] }
but it still looks like as if asset-pipeline is ignoring the existence of babel-asset-pipeline completly in assetCompile... will investigate further
maybe @davydotcom has any idea.
omg! i just realized i missed something.
actually my last answer is what was missing in the first place... you have to define those configOptions to enabled JS processing in build.gradle and put the plugin into buildscript dependencies... now everything is working like it should can you double check that i have not done black magic on my machine @yuki-takei i will prepare an updated README
You did it! Or you can define Babel as an asset dependency instead of compile... This will cause the asset pipeline plugin to add it to buildscript automagically
Sent from my iPhone
On Dec 17, 2015, at 3:24 AM, Philipp Eschenbach notifications@github.com wrote:
omg! i just realized i missed something.
actually my last answer is what was missing in the first place... you have to define those configOptions to enabled JS processing in build.gradle and put the plugin into buildscript dependencies... now everything is working like it should can you double check that i have not done black magic on my machine @yuki-takei i will prepare an updated README
— Reply to this email directly or view it on GitHub.
but then the options from application.yml would still be ignored no?
Correct has to go in gradle file too
Sent from my iPhone
On Dec 17, 2015, at 7:49 AM, Philipp Eschenbach notifications@github.com wrote:
but then the options from application.yml would still be ignored no?
— Reply to this email directly or view it on GitHub.
cool, thank you for that clarification. i will add that to the readme.
When I run gradle assetCompile
,
*.es6
are not processed correctly.@peh
I understand that following settings are needed in build.gradle
to transpile *.js
:
assets {
configOptions = [
babel: [
enabled: true,
processJsFiles: true // add if you want to transpile '*.js'
]
]
}
Thank you!
but thats because on the "broken" commit 3775f7 you disabled it completly in the babel settings?!
I am sorry for misleading you.
The state of the branch should-not-be-transpiled
I made is NORMAL.
It doesn't process *.es6
because I disabled at the commit 3775f7 as you pointed out, as I expected.
I think this issue can be closed after you update README.md.
How to reproduce?
'net.errbuddy.plugins:babel-asset-pipeline:1.4.3'
add some ES6 codes:
example.es6example.es6.jsconfiguration
gradle assetCompile
(It's also reproduced with
grails war
)What does it caused?
You'll get:
Examination 1
The error
'this language feature is only supported in es6 mode'
seems to be come from Google Closure Compiler. In the case of adding the following lines tobuild.gradle
, ES6 codes were transpiled to ES5.Examination 2
In the case of using the following lines in
build.gradle
, ES6 codes were copied without being transpiled.Questions
gradle assetCompile
?minifyJs: true
.