bublejs / buble

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

Clarify what environments are targeted by buble's codebase #93

Closed Andarist closed 6 years ago

Andarist commented 6 years ago

react-styleguidist uses buble in the browser, but unfortunately buble ships to npm codebase containing some es6 features.

I'd only want to clarify what environments buble is targeting - in which node/browser versions it should run out of the box? Would you consider transpiling more features to support older browsers like IE11 or should we fix this in a tool like react-styleguidist by transpiling buble on our own?

adrianheine commented 6 years ago

@Rich-Harris what do you think? Since IE11 doesn't support classes, #66 and #40 are relevant here, too. I would say bublé should only be compiled for node 4.

Andarist commented 6 years ago

Maybe you could transpile with node4 support in mind for main entry and for the browser it could be transpiled down to es5? Although Im not sure what to do about module entry - at the moment its mainly targeting browsers too (as its understood by bundlers), but maybe some people somehow bundle for node too? 🤔 Would be actually good to have browser:module/module:browser 😂

Andarist commented 6 years ago

@adrianheine WDYT about the proposed solution of transpiling with different targets in mind for main and browser fields?

adrianheine commented 6 years ago

I think that makes sense. We would have to find a workaround for #40, though.

Andarist commented 6 years ago

Imho that's a separate issue, that could ofc be fixed/tackled somehow but it is not tightly coupled to this one - or am I missing something?

adrianheine commented 6 years ago

It is coupled, because transpiling classes will make our errors not have a message or a stack, so we would basically break the browser build.

Andarist commented 6 years ago

Hm, I can't be sure about all old browser, but you assign custom stack property here and it is readable in latest Chrome (when using transpiled version of CompileError class). Ain't sure about description because I don't know origin of this property - you do not specify it in CompileError's constructor nor it is built-in property of native Error. Maybe you had some other prop in mind?

most.js has migrated to transpiled version of buble's output (because they have migrated to babel which didnt support extending built-ins) for their custom DisposeAllError and it seems to work OK.

adrianheine commented 6 years ago

Sorry, I meant message. It seems like you're right and CompileError already does what's necessary, so we should be able to do this.