Reputation:
It was suggested for a react-native plugin that code on npm is best transpiled before publishing instead of relying on the end-developer to transpile.
Seems fine, but react-native users probably tend to have a very homogeneous babel-based setup, so perhaps it wouldn't be so problematic to just leave it in ES6. Fancy uses similar to react-native-web could be an exception where ES6 is rather inconvenient. But then sometimes I go digging in node_modules
to see what's going on inside modules. Transpiled code would make that somewhat more difficult.
Question is: It seems like there's probably a most favorable, consistent answer. Is transpiling before publishing the right move? Am I inconveniencing people by performing this step?
Question is not: how to do this. This question addresses that very well.
Thanks!
Upvotes: 2
Views: 454
Reputation: 22872
I would say yes - transpile now. Transpile for better compatibility with todays browsers. Re-transpile your package in the future (if you care), when more ES6 features will be supported by browsers - dropping some (now) transpiled code and going with portions of native ES6.
Upvotes: 1
Reputation: 11921
To my mind yes, transpiling is a good step. We used it in react-native-drawer-layout, so we didn't have our users to enable certain babel features. On the other hand, the more Safaris JS engine reaches spec compliance with ES6, the more I would tend to say no, as transpiled code is almost always slower.
Upvotes: 1