[email protected] - Math.js blocks React Native production bundling

Created on 8 Mar 2019  路  4Comments  路  Source: josdejong/mathjs

This is the issue related to #797 .
React Native Debug bundling is no problem.
After I try to release React Native Project to TestFlight. It just crash when it start.
The error message is only showCannot convert a symbol to a string.
screen shot 2019-03-07 at 5 52 54 pm

I can't make sure what happen, so I tune the build configuration.
Understanding the process of xcode build and xcode run script build phase - react-native-xcode.sh.

After that, I definitely know the problem is caused by jsbundle. So I just build the release main.jsbundle and remove part of the code and test... test again. Finally, If I remove import * as math from 'mathjs', it just can work on release/production.

I installed npm install --save mathjs for the latest version. And Try it again. there is no luck..
Then I try npm install --save [email protected]. Due to Jonrh already test it. [email protected] by josdejong.

And it worked !!!!!

But I still don't know what happened after [email protected].
I just want to noted it for developers who face the same problem.

react-native: 0.53.6
react: 16.2.0

feature help wanted

All 4 comments

Would it be possible to try using the last 4.x release of mathjs (i.e. npm install --save mathjs@4)?

@jackmew thanks for reporting. I don't have a ReactNative setup right now so I can't easily test this myself.

I suppose you're using the latest version of mathjs. Can you try the following?

import * as math from 'mathjs/dist/math.js'

If this gives the same issue, at least we should get a more informative error and in that case I would love to know the line of code where the error occurs, that may give a clue.

Who can help out here and do some debugging?

@josdejong I came across a similar issue after moving a function that we implemented on our server (NodeJs) to our mobile app (React Native). After copying/pasting the code I received the error messageundefined is not an object (evaluating '_mathjs.default.fraction').

After changing the import statement to import * as math from 'mathjs/dist/math.js' the issue was resolved per your feedback. Thanks!

Was this page helpful?
0 / 5 - 0 ratings