Webpack packages the react project and reports an error as long as import "redux"

    import React from "react";
    import ReactDOM from "react-dom";
    // import {createStore} from "redux";
    // import {Provider} from "react-redux";
    
    import App from "./App.js";
    import reducer from "./reducers/index.js"
    // let store  = createStore(reducer);
    
    ReactDOM.render(
    // <Provider store={store}>
    //     <App></App>
    // </Provider>
    <App></App>
    ,
    document.getElementById("app-container")
)

the above code, packaged with webpack, can be compiled normally, and the content of the app component can be displayed in the browser.
but only import import {createStore} from "redux" or / / import {Provider} from "react-redux";
/ / Import without redux is normal, but importing redux is a problem, because no redux can be compiled normally, and some possibilities can be excluded

 import React from "react";
    import ReactDOM from "react-dom";
    // import {createStore} from "redux";
    import {Provider} from "react-redux";
    
    import App from "./App.js";
    import reducer from "./reducers/index.js"
    // let store  = createStore(reducer);
    
    ReactDOM.render(
    // <Provider store={store}>
    //     <App></App>
    // </Provider>
    <App></App>
    ,
    document.getElementById("app-container")
)

Jun.25,2021

should be caused by incorrect babel configuration

in .babelrc

{
    "presets": [[
        "@babel/preset-env"
    ]],
    "plugins": [
        "@babel/plugin-proposal-object-rest-spread",
        [
            "@babel/plugin-transform-runtime",
            {
                "helpers": false,
                "regenerator": true
            }
        ],
        ["es6-promise"]
    ]
}

the corresponding package.json should also be modified

"@babel/core": "^7.0.0",
        "@babel/plugin-proposal-object-rest-spread": "^7.0.0",
        "@babel/plugin-syntax-dynamic-import": "^7.0.0",
        "@babel/plugin-transform-runtime": "^7.0.0",
        "@babel/preset-env": "^7.0.0",
        "@babel/preset-es2015": "^7.0.0-beta.53",
        "@babel/preset-stage-3": "^7.0.0",
        "@babel/runtime": "^7.0.0",

if you see your error prompt, you need to install babel-transfrom-object-rest-spread, and add "plugins" to .babelrc: ["transfrom-object-rest-spread"]


how do you configure your webpack babel-loader?

guess that it may be an attempt to compile the code in node_modules, resulting in the plug-in declared in node_modules that you cannot find the error

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ffc4-2c4ee.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ffc4-2c4ee.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?