Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crashes in React Native #88

Open
radiovisual opened this issue Jan 4, 2017 · 1 comment
Open

crashes in React Native #88

radiovisual opened this issue Jan 4, 2017 · 1 comment

Comments

@radiovisual
Copy link

I pulled this module into a React Native project using

npm install --save humanize-plus

and all I did to start using it was:

var humanize = require('humanize-plus');
humanize.formatNumber(123456);

and I got the following error:

TransformError: /Users/michael/gitprojects/test/node_modules/humanize-plus/dist/humanize.js:
Couldn't find preset "es2015-riot" relative to directory "/Users/michael/gitprojects/test/node_modules/humanize-plus"

I think this might be related to Issue #86, because React Native goes through a transpile step, so it might be finding your unnecessary .babelrc file inside the package files that has es2015-riot defined as a preset:

{
  "presets": ["es2015-riot"]
}

I don't think it matters for this issue, but just in case, here are my versions of React Native:

react-native-cli: 2.0.1
react-native: 0.39.2
@iChaosren
Copy link

Quick and Dirty fix:

  • Copy humanize.min.js out of the node_modules folder.
  • Remove package
npm uninstall humanize-plus
           OR
yarn remove humanize-plus
  • Delete line in package.json if using npm and not yarn
  • Reference directly: import Humanize from '../utils/humanize.min.js';

A long term fix would be to:

  • make a new branch
  • remove "presets": ["es2015-riot"] from the .babelrc file
  • Republish on npmjs.org as something like react-native-humanizer-plus or whatever...

¯\_(ツ)_/¯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants