Hacker News new | ask | show | jobs
by jasonthevillain 3128 days ago
I've learned the hard way to check Babel's output for sanity.

Sometimes its fine.

Other times it's madness or pulls in a massive polyfill. That's sort of inherent to making a transpiler: they need to match the spec. I usually just need one specific behavior that could be written in a 3 line helper function.

2 comments

They have a "loose" mode for most compilations that can benefit from them.

In loose mode they might not follow the letter of the spec, but can cheat for speed or size.

Yep you got that right!

Only thing I can think of (since changing the default to be non-spec would be odd) is just warning on larger code size outputs and saying you could try loose mode in certain plugins/situations. Lastly would be do start creating a tool that does runtime checks to determine how small the compiled output should be