-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
optimize: true breaks es6 compatibility #117
Comments
I am happy to send PR but I dont know what strategy we should take for fixing this.. thoughts are welcome :) |
so which of these lines is failng? What happens if you disable one of them?
…On Tue, Jan 17, 2017 at 4:42 PM Matt McFarland ***@***.***> wrote:
I am happy to send PR but I dont know what strategy we should take for
fixing this.. thoughts are welcome :)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#117 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACWlenmZNdX0Al18Q14XV3F8YQdkupJ6ks5rTOFogaJpZM4LlC9h>
.
|
Both fail, when disabling one or the other uglifyjs does not like template tags nor does it like arrow functions. |
I think one way to fix this would be to transpile before it is sent to uglifyjs. However, if you transpile first then call yoyoify it blows up. The problem is that yoyoify has to be called before you transpile and you have to transpile before you run uglifyjs - I havent confirmed this but that is the only thing that makes logical sense to me atm. |
Yeah I think what you're saying makes sense. I think you can circumvent
this by including es2020 + yo-yoify in your package JSON though, in the
right order
…On Sat, Jan 21, 2017, 23:09 Matt McFarland ***@***.***> wrote:
I think one way to fix this would be to transpile before it is sent to
uglifyjs. However, if you transpile first then call yoyoify it blows up.
The problem is that yoyoify has to be called before you transpile and you
have to transpile before you run uglifyjs - I havent confirmed this but
that is the only thing that makes logical sense to me atm.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#117 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACWlehzDlz-1Yyqq5qUiE063YbhGUtLPks5rUoIRgaJpZM4LlC9h>
.
|
The workaround for this, as @yoshuawuyts says, is to have duplicate yoyoify and sheetify transforms before babelify. Not ideal but it seems to work. const jsOpts = {
js: {
transform: [
'envify',
'sheetify/transform',
'yo-yoify',
['babelify', { presets: ['latest'] }]
]
},
optimize: true
}
const clientPath = path.join(__dirname, '../client/app.js')
client = bankai(clientPath, jsOpts) |
Hi guys, same problem here! "script": {
"build:browser": "bankai build browser/index.js --optimize --electron build-browser/"
}
"browserify": {
"transform": [
"unassertify",
"yo-yoify",
"es2020"
]
} |
You can now do |
Steps to reproduce:
Create a blank project using bankai
For your client.js code, simply add the following lines:
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 thejs
property you get another error stating that thepath to client.js cannot be found
. If you disableyoyoify
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
oroptimize
and have the ability to explicitly use different transforms whenoptimize
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.
See also: mishoo/UglifyJS#1411
The text was updated successfully, but these errors were encountered: