bublejs / buble

https://buble.surge.sh
MIT License
871 stars 67 forks source link

[idea] transpaling on the fly in the browser 💡 #133

Closed TryHardNinja closed 6 years ago

TryHardNinja commented 6 years ago

Dear Rich Harris Is it possible to implement transpaling on the fly in the browser? The idea is that only those features that are not supported in the browser are converted. Sorry for my English If there are prototypes or ready-made implementations of this idea, I will be glad to see

fskreuz commented 6 years ago

Transpilation isn't the same as polyfilling/shimming. Polyfills and shims just adds missing APIs. What you don't need, you don't add, and therefore doesn't get shipped.

On the other hand, a transpiler has to parse and transpile. This means pushing the parser, the transpiler, and all their dependencies down the wire. And even if you don't transpile certain pieces of code, you still need to parse the entire code for the transpiler to understand it. You now have a bandwidth and processing problem.

trusktr commented 5 years ago

@adrianheine What's the answer? You closed this but an answer wasn't provided.

adrianheine commented 5 years ago

Indeed, huh. I think this is out-of-scope for bublé and not a terribly good idea to begin with, but of course everyone is free to work on this as a separate project and I'd be interested to see the results and happy to help from bublé's side.