You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having this option enabled by default in babili preset can cause a lot of issues, especially when using Babili on the server side with express.js, which relies on arguments.length, because it will convert an error handler to a normal middleware by removing the last parameter:
It's also causing issues with ioredis library (and probably many more), which unfortunately also relies on arguments.length in a few places.
If enabling this by default is not an option, maybe a warning about it could be added to the README for Babili or babili-preset package? Currently it's only mentioned in the README for dead code elimination plugin itself, but I doubt people usually go through every plugin in the preset to see what options they have and if they are potentially dangerous. Or maybe there could be a babel-babili-preset-safe with all these keep* options turned on?
Thanks for bringing this up. I'd better have warnings rather than not doing the unsafe transformations - as it's tedious to specify the option to do the transformation instead of specifying it for NOT doing the transformation for a common case. A lot of transformations that a minifier does is unsafe. So, it would be nice to add warnings at all those places which are unsafe transformations.
As you mentioned, the warnings could be added to the babili JS API, console.warn during the transformation for Node/CLI and also a mention in the README.
Activity
boopathi commentedon Jun 7, 2017
Thanks for bringing this up. I'd better have warnings rather than not doing the unsafe transformations - as it's tedious to specify the option to do the transformation instead of specifying it for NOT doing the transformation for a common case. A lot of transformations that a minifier does is unsafe. So, it would be nice to add warnings at all those places which are unsafe transformations.
As you mentioned, the warnings could be added to the babili JS API, console.warn during the transformation for Node/CLI and also a mention in the README.
[-]Enable keepFnArgs in dead code elimination plugin by default[/-][+]Enable warnings for unsafe transformations[/+]jogibear9988 commentedon Dec 17, 2017
Is is not also wrong, that the unicode characters get converted to a escape sequence?