React Native 错误:您目前正在使用 Redux 在 NODE_ENV === 'production' 之外使用缩小代码 [英] React Native Error: You are currently using minified code outside of NODE_ENV === 'production' using Redux

查看:27
本文介绍了React Native 错误:您目前正在使用 Redux 在 NODE_ENV === 'production' 之外使用缩小代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找并试图摆脱这个错误,但没有成功.我阅读了 webpack 的整个文档并尝试正确实现它,但似乎不起作用.我用的expo,可能是expo的入口有问题,不知道.

I've been searching and trying to get rid of this error without success. I read the whole documentation of webpack and tried to implement it correctly, but it seems not work. I use expo, maybe there is an issue with the entry of expo, but I don't know.

这是我的代码:

webpack.config.js

 var path = require('path');

module.exports = {
  mode: 'production',
  entry: "./App.js",
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'bundle.js'
  },
};

App.js

import * as React from "react";
import { Provider } from "react-redux";
import { createStore  } from "redux";
import { reducers } from "./reducers";

import { Drawer } from "./Navigation";
import LibraryReducer from "./reducers/LibraryReducer";

export default class App extends React.Component {
  render() {
    const store = createStore(LibraryReducer)
    return (
      <Provider store={store}>
        <Drawer />
      </Provider>

    );
  }
}

package.json

{
  "name": "empty-project-template",
  "main": "node_modules/expo/AppEntry.js",
  "private": true,
  "scripts": {
    "start": "webpack",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "eject": "expo eject",
    "build": "webpack --config webpack.config.js"
  },
  "dependencies": {
    "@babel/core": "^7.0.0",
    "@babel/plugin-transform-react-jsx-source": "^7.0.0",
    "@expo/vector-icons": "^8.0.0",
    "babel-preset-expo": "^5.0.0",
    "create-webpack-config": "^0.2.1",
    "db": "^1.1.1",
    "expo": "^31.0.0",
    "expo-asset": "^1.0.2",
    "expo-constants": "^1.1.0",
    "expo-core": "^1.2.0",
    "expo-file-system": "^1.1.0",
    "expo-font": "^1.1.0",
    "expo-react-native-adapter": "^1.0.2",
    "loose-envify": "^1.4.0",
    "metro-react-native-babel-preset": "^0.50.0",
    "native-base": "^2.8.0",
    "pirates": "^4.0.0",
    "react": "16.5.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-31.0.0.tar.gz",
    "react-native-calendars": "^1.20.0",
    "react-native-dialog": "^5.3.0",
    "react-native-elements": "^0.19.1",
    "react-native-haptic-feedback": "^1.2.0",
    "react-native-simple-dialogs": "^0.4.1",
    "react-native-swipeout": "^2.3.6",
    "react-native-vector-icons": "^5.0.0",
    "react-native-view-overflow": "^0.0.3",
    "react-navigation": "^2.12.1",
    "react-redux": "^6.0.0",
    "redux": "^4.0.1",
    "watchman": "^1.0.0"
  },
  "devDependencies": {
    "webpack": "^4.27.1",
    "webpack-cli": "^3.1.2"
  }
}

.babelrc

{
  "presets": ["module:metro-react-native-babel-preset"]
}

欢迎提出任何想法.

推荐答案

您可能很久以前就解决了这个问题,但我遇到了同样的问题,并通过将 .expo/settings 中的 minify 设置更改为这一行来解决它.json:

You probably fixed this long ago, but I had the same problem and fixed it by changing the minify setting to this line in .expo/settings.json:

"minify": false

之前设置为true.

这篇关于React Native 错误:您目前正在使用 Redux 在 NODE_ENV === 'production' 之外使用缩小代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆