小编Iva*_*hyn的帖子

使用 webpack 加载 .jsx 文件

我在.jsx使用webpack. 我有这个webpack.config.js

var webpack = require('webpack');

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

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

module: {
    loaders: [
        {
            test: /\.js$/,
            loader: "babel-loader",
            exclude: [/node_modules/, /public/],
            query: {
                plugins: ['transform-runtime'],
                presets: ['es2015', 'stage-0', 'react']
            }
        },
        {
            test: /\.jsx$/,
            loader: "react-hot!babel",
            exclude: [/node_modules/, /public/]
        }
    ]
}
};
Run Code Online (Sandbox Code Playgroud)

我的应用程序有这个包:

"dependencies": {
    "jquery": "^3.1.0",
    "react": "^15.2.1",
    "react-dom": "^15.2.1"
},
    "devDependencies": {
    "autoprefixer-loader": …
Run Code Online (Sandbox Code Playgroud)

javascript jsx reactjs webpack

5
推荐指数
1
解决办法
1万
查看次数

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

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

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

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

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

Uncaught NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
Run Code Online (Sandbox Code Playgroud)

然后

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

'标题' - 应用程序的组件之一.

奇怪的是,此错误仅在某些版本的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" …
Run Code Online (Sandbox Code Playgroud)

runtime-error cross-browser flux reactjs react-router

5
推荐指数
0
解决办法
649
查看次数