UNPKG

react-native-web-config

Version:
34 lines 2.1 kB
{ "name": "react-native-web-config", "version": "0.0.5", "description": "react-native-config for Web", "keywords": [ "react-native-config", "web" ], "license": "MIT", "repository": "https://github.com/preflower/react-native-web-adapter/tree/master/packages/react-native-web-config", "author": "Ted Lin <preflower.lin@gmail.com> (https://github.com/preflower)", "files": [ "index.js", "plugin.js" ], "main": "index.js", "bugs": { "url": "https://github.com/preflower/react-native-web-adapter/issues" }, "homepage": "https://github.com/preflower/react-native-web-adapter/tree/master/packages/react-native-web-config", "peerDependencies": { "webpack": "*" }, "dependencies": { "dotenv": "^16.0.0" }, "devDependencies": { "webpack": "^5.68.0" }, "publishConfig": { "access": "public" }, "readme": "# react-native-web-config\n\n[![npm version](https://badge.fury.io/js/react-native-web-config.svg)](https://badge.fury.io/js/react-native-web-config)\n\n[react-native-config](https://github.com/luggit/react-native-config) for Web.\n\n## Overview\nInspired by [react-web-config](https://github.com/tanhauhau/react-web-config)\n\nThis repository purpose is to repair `react-web-config` not support webpack 3 or above version error.\n\n## Usage\n```bash\n$ npm i react-native-web-config\n```\n\nwebpack.config.js\n```diff\n const webpack = require('webpack');\n+ const ReactNativeWebConfig = require('react-native-web-config/plugin');\n+ const path = require('path');\n+ /* .env is default name, if you set custom name please replace it */\n+ const envFilePath = path.resolve(__dirname, '.env');\n module.exports = {\n ...\n plugins: [\n ...\n+ /* define __REACT_NATIVE_WEB_CONFIG__ */\n+ ReactNativeWebConfig(envFilePath)\n ],\n resolve: [\n alias: [\n ...\n 'react-native': 'react-native-web',\n+ /* set alias from react-native-config to react-native-web-config */\n+ 'react-native-config': 'react-native-web-config'\n ]\n ]\n }\n```\n\n## License\nMIT\n" }