optimize: true breaks es6 compatibility
See original GitHub issueSteps to reproduce:
-
Create a blank project using bankai
-
For your client.js code, simply add the following lines:
var foo = `bar`
var func = (args) => console.log
Expected results Should be no error
Actual results
the node instance blows up and appears that uglifyjs
is parsing with es5 rules.
some notes/findings: Using babelify, es2020 do not work
When trying to use those as transforms in package.json
or passed into browserify using the js
property you get another error stating that the path to client.js cannot be found
. If you disable yoyoify
you then get the same damn uglifyjs error anyway. I think that the transforms might not be called in the correct order, but I am not sure.
yoyoify transpiles backticks if you use them with bel/yo/choo - Optimize will not fail if you are using template tag strings that are passed in to bel/yo/choo - but that is the only case. using fat arrow functions though will not work at all.
Suggested fix
Let developers overload js
or optimize
and have the ability to explicitly use different transforms when optimize
is true. this could be messy but this would add some flexibility.
Or maybe ditch the uglifyjs transform all together and just pipe the finished browserify stream to uglifyjs when everything is done?? idk if that will work but right now I’m just not sure how to get this to work other than to use es5 only which makes me sad.
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
The workaround for this, as @yoshuawuyts says, is to have duplicate yoyoify and sheetify transforms before babelify. Not ideal but it seems to work.
You can now do
--uglify false
and it should no longer crash, can just pull in your own uglify (: Given the lack of activity I think this issue has been resolved. Feel free to reopen if it hasn’t been. Cheers!