AbhyudayaSharma / react-git-info

Get Git commit information in your React App

Home Page:https://www.npmjs.com/package/react-git-info

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: can this work with React Native?

Twinbird24 opened this issue · comments

I'm wondering if there's a way to get this to work with React Native. This package seems to drop to the command line at runtime so it's not going to work on a device, it would need to grab the git info when compiling the app (maybe via some babel-plugin or something). However, I've so far not found a way to make it work—is this even possible for react-native?

Hi @Twinbird24. I have never used react native so I can't say for sure this package will work. However, from a quick search, I think it might be possible to use babel with React native. If it is, then you can install babel-plugin-macros as a devDependency. After that, this package should work as intended.

Closing as stale. Please reopen if you require any help.

commented

For anyone else coming across this issue, it doesn't work:

The package at "node_modules\react-git-info\src\GitInfo.macro.js" attempted to import the Node standard library module "child_process".
It failed because the native React runtime does not include the Node standard library.
Learn more: https://docs.expo.dev/workflow/using-libraries/#using-third-party-libraries