Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

Webpack 4.5.0 package react 16.3.1 popProvider error #274

Closed
webpack-bot opened this issue Apr 6, 2018 · 3 comments
Closed

Webpack 4.5.0 package react 16.3.1 popProvider error #274

webpack-bot opened this issue Apr 6, 2018 · 3 comments

Comments

@webpack-bot
Copy link

Do you want to request a feature or report a bug?
report a bug

What is the current behavior?
hi,I used webpack 4.5.0 to package react 16.3.1 and react-dom 16.3.1. There was no problem with compiling, but there was a react-dom.development.js problem with the browser:

Uncaught TypeError: Cannot read property 'popProvider' of undefined

Opened the react-dom.development.js file and there was a problem with this sentence:

var popProvider = newContext.popProvider;

in ReactFiberScheduler Function.
I have just discovered that this problem only occurs in the development mode, there is no problem in the production mode.

If the current behavior is a bug, please provide the steps to reproduce.
I tried to pack react 16.3.1 and react-dom 16.3.1 with webpack 3.x and webpack devserver 2.x, no problem.
Below is my webpack.config.js:

const webpack = require("webpack"),
    path = require("path"),
    ExtractTextPlugin = require("extract-text-webpack-plugin"),
    HtmlWebpackPlugin = require("html-webpack-plugin"),
    UglifyJsPlugin = require("uglifyjs-webpack-plugin");

const PUBLIC_DIR = "/",
    DLL_DIR = path.resolve(__dirname, "../dll"),
    APP_DIR = path.resolve(__dirname, "../scripts"),
    ROOT_DIR = path.resolve(__dirname, "../"),
    BUILD_DIR = path.resolve(__dirname, "../build"),
    STYLE_DIR = path.resolve(__dirname, "../stylesheets"),
    MANIFEST_DIR = require(path.resolve(__dirname, `${DLL_DIR}/vendor_manifest.dll.json`));

const port = 9997;

const webpackDevConfig = {
    mode: "development",
    devtool: "source-map",
    entry: {
        index: `${APP_DIR}/index.js`
    },
    output: {
        publicPath: PUBLIC_DIR,
        filename: "[name]_[hash].js",
        path: BUILD_DIR
    },
    optimization: {
        minimize: true,
        minimizer: [
            new UglifyJsPlugin({
                sourceMap: true,
                uglifyOptions: {
                    compress: {
                        unused: false,
                        dead_code: false,
                        warnings: true
                    },
                    output: {
                        comments: true
                    }
                }
            })
        ]
    },
    resolve: {
        modules: [
            "node_modules",
            APP_DIR,
            DLL_DIR
        ]
    },
    externals: {
        jquery: "jQuery"
    },
    module: {
        rules: [{
            test: /.js[x]?$/,
            include: [
                APP_DIR,
                DLL_DIR,
                STYLE_DIR
            ],
            use: [{loader: "babel-loader"}]
        }, {
            test: /.css$/,
            use: ExtractTextPlugin.extract({
                fallback: "style-loader",
                use: [{loader: "css-loader", options: {importLoaders: 1}}, {loader: "postcss-loader"}],
                publicPath: STYLE_DIR
            })
        }, {
            test: /.(png|jpg|jpeg|bmp|gif)$/,
            use: [{
                loader: "url-loader",
                options: {
                    limit: 10000
                }
            }, {loader: "image-webpack-loader"}]
        }]
    },
    plugins: [
        new webpack.NoEmitOnErrorsPlugin(),
        new webpack.DllReferencePlugin({
            manifest: MANIFEST_DIR,
            context: ROOT_DIR
        }),
        new ExtractTextPlugin("[name]_[hash].css"),
        new HtmlWebpackPlugin({
            publicPath: PUBLIC_DIR,
            filename: "index.html",
            template: `${ROOT_DIR}/index.html`,
            chunks: ['index'],
            inject: 'body'
        })
    ],
    devServer: {
        host: "0.0.0.0",
        port: port,
        proxy: {},
        historyApiFallback: true
    }
};

module.exports = webpackDevConfig;

What is the expected behavior?

Please mention other relevant information such as the browser version, Node.js version, webpack version, and Operating System.
webpack 4.5.0
macOs High Sierra 10.13.3


This issue was moved from webpack/webpack#6969 by @montogeek. Original issue was by @dreamthen.

@alexander-akait
Copy link
Member

@dreamthen Hi. Can you create minimum reproducible test repo?

@montogeek
Copy link

@evilebottnawi it is in the original issue: webpack/webpack#6969 (comment)
also on React repo: facebook/react#12555

@alexander-akait
Copy link
Member

Problem with uglify-es. Close in favor #262

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants