react-native-web-config

0.0.5 • Public • Published

react-native-web-config

npm version

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

Package Sidebar

Install

npm i react-native-web-config

Weekly Downloads

143

Version

0.0.5

License

MIT

Unpacked Size

4.75 kB

Total Files

5

Last publish

Collaborators

  • preflower