{"library":"react-web-config","title":"react-web-config","description":"A drop-in replacement for react-native-config that makes environment variables from a .env file accessible in React Native Web projects. Version 1.0.0 is stable, with no recent updates. It works by aliasing react-native-config to react-web-config and injecting variables via a webpack plugin. Unlike alternatives that require separate config files or build-time substitution, it mirrors the react-native-config API exactly, making migration seamless. It has minimal dependencies and is intended for projects already using react-native-config with react-native-web.","language":"javascript","status":"active","last_verified":"Fri May 01","install":{"commands":["npm install react-web-config"],"cli":null},"imports":["import { ReactWebConfig } from 'react-web-config/lib/ReactWebConfig';","import Config from 'react-native-config';","Config = require('react-native-config'); config.API_URL;"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"// First, ensure you have a .env file in your project root with variables like:\n// API_URL=https://myapi.com\n\n// In webpack.config.js, add:\nconst webpack = require('webpack');\nconst path = require('path');\nconst { ReactWebConfig } = require('react-web-config/lib/ReactWebConfig');\n\nconst envFilePath = path.resolve(__dirname, '.env');\n\nmodule.exports = {\n  plugins: [\n    ReactWebConfig(envFilePath)\n  ],\n  resolve: {\n    alias: {\n      'react-native-config': 'react-web-config',\n      'react-native': 'react-native-web'\n    }\n  }\n};\n\n// In your app code:\nimport Config from 'react-native-config';\nconst API_URL = Config.API_URL; // 'https://myapi.com'","lang":"javascript","description":"Shows how to set up react-web-config with webpack alias and plugin to read .env variables.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}