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.
npm install react-web-configNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to set up react-web-config with webpack alias and plugin to read .env variables.
Ensure .env file exists in the root directory as specified by envFilePath.
Restart the dev server after modifying .env file.
Use dotenv-webpack if you need those features, but it may conflict.
Ensure resolve.alias includes 'react-native-config': 'react-web-config'.
Use { ReactWebConfig } from 'react-web-config/lib/ReactWebConfig'.Add ReactWebConfig(envFilePath) to plugins array and verify .env exists.