TransformError: ENOENT no such file or directory .babelrc with precompiled npm module
I have a personal npm module, written in es6. It has a prepublish hook that babel transpiles it to es5. In package.json the main field points to the compiled version. .babelrc and es6 src/ are added to .npmignore. So to anyone installing the npm module, the fact that the module is written in es6 should be "invisible". This holds true when installing the module in regular react/webpack builds for both browser and electron.
However, when installing the module in my react native app, I get an error along the lines of: TransformError: ENOENT no such file or directory .babelrc
Here is a screenshot of the full error: https://www.dropbox.com/s/5lwe5fyf44emh6l/Screenshot%202016-06-03%2000.43.53.png?dl=0
The npm module can be found here: https://github.com/felixmc/redux-actions-magic Feel free to try it for yourself.
I can't seem to find many other running into this issue..If I include the .babelrc in the module, I get a series of other errors (couldn't find X preset, etc). Other issues on here seem to suggest that .babelrc should be avoided in npm packages anyway for that very reason.
I guess don't understand why react-native would even be looking for a .babelrc. The module only has babel as a dev dependency.
Here are my versions of things: node: 6.2.0 react-native-cli: 0.2.0 react-native: 0.26.3
The error happens in both the android and ios emulators. My dev environment is OS X.
This is probably related to this issue: https://github.com/facebook/react-native/issues/7850
I have this problem also on a module that doesn't use .babelrc anymore. It just strikes me that these issues come out of nowhere. Seems to have worked before and now completely stuck.
@mschipperheyn Try resetting the packager's cache:
./node_modules/react-native/packager/packager.sh start --reset-cache
Also bear in mind that react-native's transform picks up .babelrc in parent-directories like your home-folder as well.
@fab1an this really works! save my day ! thx~
@chengmu Can you close this?
I confirm that this works!
Closing this issue because it has been inactive for a while. If you think it should still be opened let us know why.
This helped for me, except that now I found the packager script here: ./node_modules/react-native/scripts/packager.sh start --reset-cache. Looks like it was moved in this commit