Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

react-native-web-config

npm version npm download license

react-native-config for Web.

Overview

Inspired by react-web-config

This repository purpose is to repair react-web-config not support webpack 3 or above version error.

Usage

$ npm i react-native-web-config

webpack.config.js

  const webpack = require('webpack');
+ const ReactNativeWebConfig = require('react-native-web-config/plugin');
+ const path = require('path');
+ /* .env is default name, if you set custom name please replace it */
+ const envFilePath = path.resolve(__dirname, '.env');
  module.exports = {
    ...
    plugins: [
      ...
+     /* define __REACT_NATIVE_WEB_CONFIG__ */
+     ReactNativeWebConfig(envFilePath)
    ],
    resolve: [
      alias: [
        ...
        'react-native': 'react-native-web',
+       /* set alias from react-native-config to react-native-web-config */
+       'react-native-config': 'react-native-web-config'
      ]
    ]
  }

License

MIT