Closed peterpme closed 7 years ago
Good idea. Will do in the next version.
I'll keep this issue open until I ship the compiled version.
:+1: thank you
Haven't gotten to this yet. Swamped on some other projects.
Question I was thinking of though. When shipping react-native and using the build command react-native bundle --minify
won't this source get minified in the process? Would it still be helpful to provide a pre-compiled version in NPM?
Thx
yes, because you're otherwise requiring a transpiler dependency, rather than just letting the user use it as is.
I personally exclude babel to run through my node_modules, it's not necessary. I've had to create a flag for this plugin.
I would help you set this up actually, but it's not something you add to the repo. You just have a dist folder that's gitignored. npm will default to using dist in production, and the real source in dev mode
Ok, I put up a branch with the compiled versions master.provideBuild
. Can you check it out and see if it looks good. I've been out of the JS scene for a bit.
From what you were saying, it seems like even if I add dist
to .gitignore
, npm
will auto-magically use that folder for npm publish
?
Also, I moved ./index.js
to lib/index.js
so it was included in the transpiling.
Here's a simple repo where I've done the same: https://github.com/rreusser/react-native-paged-scroll-view
I .npmignored the source directory and .gitignored the build directory. I also had to .npmignore .babelrc, otherwise it broke actual builds. Finally, the prepublish script builds before publishing. It's not perfect and I'm sure there's more than one way to do it, but hope that's at least a reference point, if needed!
And to answer your question, I think the entry point in package.json
needs to be the compiled version, even if that's gitignored.
The newest npm update includes the transpiled code in /dist
. For now, I'm keeping package.json
pointing to /lib
. But the code is now available for reference/use in /dist
.
Hope that helps
I don't think it is necessary to have a compiled version of this package
react native handle well non compiled code
The latest version provides both compiled versions, as well as map
files to help debuggers show the code in their original form. Should be best of both worlds.
Closing this issue. Please reopen should the current situation in v0.3.10
causes complications.
@sibelius FWIW I wasn't sure either but asked on stackoverflow and was offered some suggestions. I liked this as a general answer:
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.
Not sure where we are in the transition, but whatever the answer, I think a "transition" to omitting it is a decent rationale.
react-native packager enable all stage-0 features anyway
I hope we all delivery non compiled code in the future and let webpack/rollup only transpilers what is needed
Hi there,
This is great! My only concern is that I exclude
node_modules
. I can whitelist this package but it would be great if there were a compiled version we can use.Thank you, Peter