You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
undefined is not a function (evaluating 'babelHelpers.typeof(obj)') using nes library #8074
changed the title [-]babelHelpers.typeof is not a function using nes[/-][+]undefined is not a function (evaluating 'babelHelpers.typeof(obj)') using nes library[/+]on Jun 12, 2016
I had this issue with one of our own modules earlier and ended up switching that module to use the react-native preset so that we don't have to maintain a fork of React Native.
The proper fix will be to add the ability to specify a babelHelpers file to react-native packager. PRs are welcome.
I got a similar error multiple times while I was starting with react-native on the last 2 days.
First I previously add a development section in my babel conf where es2015 where using, so boom. Took me a while to understand that, even with all those errors.
After that, (I now launch npm start with NODE_ENV=native to avoid babel using development section - which is the default behavior), I used react-router-native (which rely on react-router) which rely on babel-preset-stage-1.
Having this babelHelpers.typeof is not a function error is really not explicit.
I am still new with react-native, but I saw that some times, errors are caught and displayed with nice explanations (like when using react/react-dom - which is a good thing).
Don't you think this generic error could be caught and enhanced to prevent people wasting time on this, like I just did for a couple of hours?
@MoOx It seems like a good idea to add an extra warning when this happens. Interested in sending a pull request? ;-)
Otherwise, it seems like this is an issue with a known workaround, rather than an outstanding bug, so I am going to close this issue. I think the right fix is to stop transpiling npm modules but for now there are workarounds.
Activity
[-]babelHelpers.typeof is not a function using nes[/-][+]undefined is not a function (evaluating 'babelHelpers.typeof(obj)') using nes library[/+]satya164 commentedon Jun 12, 2016
Seems the nes module is pre-compiled with babel using the es2015 preset.React Native uses a different babelHelpers file which might be causing issues. The only workaround I know as of now is to fork React Native and replace it's babelHelpers file with a standard babelHelpers file as documented here - https://github.com/facebook/react-native/blob/235b16d93287061a09c4624e612b5dc4f960ce47/packager/react-packager/src/Resolver/polyfills/babelHelpers.js#L13
I had this issue with one of our own modules earlier and ended up switching that module to use the
react-nativepreset so that we don't have to maintain a fork of React Native.The proper fix will be to add the ability to specify a babelHelpers file to react-native packager. PRs are welcome.
byoigres commentedon Jun 13, 2016
Well, I ended using this solution and it works perfectly.
satya164 commentedon Jun 13, 2016
Awesome. I had actually used that solution in past, but it broke with RN upgrade.
MoOx commentedon Sep 21, 2016
I got a similar error multiple times while I was starting with react-native on the last 2 days.
First I previously add a development section in my babel conf where es2015 where using, so boom. Took me a while to understand that, even with all those errors.
After that, (I now launch
npm startwithNODE_ENV=nativeto avoid babel using development section - which is the default behavior), I used react-router-native (which rely on react-router) which rely on babel-preset-stage-1.Having this
babelHelpers.typeof is not a functionerror is really not explicit.I am still new with react-native, but I saw that some times, errors are caught and displayed with nice explanations (like when using react/react-dom - which is a good thing).
Don't you think this generic error could be caught and enhanced to prevent people wasting time on this, like I just did for a couple of hours?
lacker commentedon Nov 29, 2016
@MoOx It seems like a good idea to add an extra warning when this happens. Interested in sending a pull request? ;-)
Otherwise, it seems like this is an issue with a known workaround, rather than an outstanding bug, so I am going to close this issue. I think the right fix is to stop transpiling npm modules but for now there are workarounds.