React - 某些浏览器中的奇怪致命错误

时间:2016-09-23 09:15:35

标签: reactjs cross-browser runtime-error react-router flux

有关奇怪错误的问题,仅在某些浏览器中出现。

我有一个巨大的单页面应用程序,类似于带有文件和文件夹的文件存储。这个应用程序建立在react和flux上,我使用react-router进行路由。

在某些浏览器中,我发现了一个严重的错误,我找不到合适的解决方案。

问题是,当我尝试下载文件夹中的文件时,会出现以下错误:

Uncaught NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.

之后

Uncaught (in promise) Error: Attempted to update component `Header` that has already been unmounted (or failed to mount).

'标题' - 应用程序的一个组件。

奇怪的是,只有某些版本的Chrome和Firefox才会出现此错误。我认为问题出现在第一次错误中。

这是我的webpack配置:

const webpack = require('webpack');
const NODE_ENV = process.env.NODE_ENV || 'development';

module.exports = {
    context: __dirname + '/src',
    entry: {
        index: './index'
    },
    output: {
        path: __dirname + '/public',
        publicPath: "/public",
        filename: "bundle.js"
    },

    watch: NODE_ENV == 'development',
    watchOptions: {
        aggregateTimeout: 100
    },

    resolve: {
        modulesDirectories: ["node_modules"],
        extensions: ['', '.js', '.jsx']
    },

    resolveLoader: {
        modulesDirectories: ["node_modules"],
        moduleTemplates: ["*-loader", "*"],
        extensions: ['', '.js', '.jsx']
    },

    plugins: [

    ],

    module: {
        loaders: [
            {
                test: /\.js|jsx$/,
                loader: "babel",
                exclude: [/node_modules/],
                query: {
                    plugins: ['transform-runtime'],
                    presets: ['es2015', 'react', 'stage-0']
                }
            }
        ]
    }
    };

if(NODE_ENV == 'production') {
        module.exports.plugins.push(
            new webpack.optimize.UglifyJsPlugin({
                compress: {
                    warnings: false,
                    drop_console: true,
                    unsafe: true
                }
            })
        );
}

我的package.json:

"devDependencies": {
    "babel": "^6.5.2",
    "babel-core": "^6.13.1",
    "babel-loader": "^6.2.4",
    "babel-plugin-transform-runtime": "^6.12.0",
    "babel-polyfill": "^6.13.0",
    "babel-preset-es2015": "^6.13.1",
    "babel-preset-react": "^6.11.1",
    "babel-preset-stage-0": "^6.5.0",
    "babel-runtime": "^6.11.6",
    "webpack": "^1.13.1"
},
"dependencies": {
    "axios": "^0.14.0",
    "choices.js": "^2.0.2",
    "events": "^1.1.1",
    "flux": "^2.1.1",
    "keymirror": "^0.1.1",
    "react": "^15.3.0",
    "react-addons-css-transition-group": "^15.3.1",
    "react-alert": "^1.0.14",
    "react-dom": "^15.3.0",
    "react-dotdotdot": "^1.0.16",
    "react-image-lightbox": "^3.1.0",
    "react-mixin": "^3.0.5",
    "react-modal": "^1.4.0",
    "react-player": "^0.9.0",
    "react-router": "^2.6.1"
  }

有没有人知道这是什么? 因为问题可能是什么?

0 个答案:

没有答案