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:
app.use((err, req, res, next) => {
if (err) { res.status(500).send('¯\_(ツ)_/¯') }
});
gets converted to:
app.use((a,b,c)=>{a&&c.status(500).send('\xAF_(\u30C4)_/\xAF')});
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?
Having this option enabled by default in
babilipreset can cause a lot of issues, especially when using Babili on the server side with express.js, which relies onarguments.length, because it will convert an error handler to a normal middleware by removing the last parameter:gets converted to:
It's also causing issues with ioredis library (and probably many more), which unfortunately also relies on
arguments.lengthin 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-safewith all thesekeep*options turned on?