Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/waynekim92/babel-plugin-local-ip
Do you want to automatically replace local IP? (I implemented this because I did not want to troubleshoot the reactotron host IP.)
https://github.com/waynekim92/babel-plugin-local-ip
babel-plugin device physical-device physical-devices react-native reactotron
Last synced: about 5 hours ago
JSON representation
Do you want to automatically replace local IP? (I implemented this because I did not want to troubleshoot the reactotron host IP.)
- Host: GitHub
- URL: https://github.com/waynekim92/babel-plugin-local-ip
- Owner: WayneKim92
- Created: 2024-04-26T06:51:54.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-04-26T10:27:16.000Z (6 months ago)
- Last Synced: 2024-04-27T08:35:39.157Z (6 months ago)
- Topics: babel-plugin, device, physical-device, physical-devices, react-native, reactotron
- Language: JavaScript
- Homepage:
- Size: 16.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Install
```shell
yarn add babel-plugin-local-ip -D
# or
npm install babel-plugin-local-ip -D
```
# Config
```shell
// In babel.config.js
plugins: ["babel-plugin-local-ip"] # "LOCAL_IP" string will be replaced with the local IP of the machine where the metro is running.
# or
plugins: [
[
"babel-plugin-local-ip", {
"replaceString": "FOO_LOCAL_IP", # (Option) If you want to change it to a different string value.
"interfaceName": "en0" # (Option) If you can't use the network as en0, Replace "en0" with your network type name.
}
]
]
```
- If you cannot use en0, please refer to the original [code](https://github.com/WayneKim92/babel-plugin-local-ip/blob/main/plugin/local-ip.js).# Description
This plugin was created to automatically enter the local IP of the machine where **[reactotron](https://github.com/infinitered/reactotron)** is running.```typescript
import { Platform } from 'react-native';
import Reactotron from 'reactotron-react-native';const os = Platform.OS;
Reactotron.configure({
name: `App Name ${os}`,
getClientId: async () => `App Name ${os}`,
host: 'LOCAL_IP', // babel-plugin-local-ip will convert it to local IP on the machine your metro is running on.
})
```# AS-IS
```
const LocalIP = "Local_IP"
```# TO-BE
```
// if your local ip is "192.168.0.77"
const LocalIP = "192.168.0.77"
```# reference
- https://astexplorer.net/