Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/417.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用Web包运行React应用程序时出现的问题_Javascript_Html_Reactjs_Webpack_Es6 Promise - Fatal编程技术网

Javascript 使用Web包运行React应用程序时出现的问题

Javascript 使用Web包运行React应用程序时出现的问题,javascript,html,reactjs,webpack,es6-promise,Javascript,Html,Reactjs,Webpack,Es6 Promise,这段代码是我的webpack.config.js文件 const path = require("path"); const HtmlWebpackPlugin = require("html-webpack-plugin"); module.exports = { entry: "./src/index.js", output: { path: path.join(__dirname, "./dist"), publicPath: '/dist

这段代码是我的webpack.config.js文件

const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");

module.exports = {
    entry: "./src/index.js",
    output: {
        path: path.join(__dirname, "./dist"),
        publicPath: '/dist/',
        filename: "index_bundle.js"
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                use: {
                    loader: "babel-loader"
                },
            },
            {
                test: /\.css$/,
                use: ["style-loader", "css-loader"]
            }
        ]
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: "./src/index.html"
        })
    ],
    devServer: {
        publicPath: '/dist/'
    }
};

附件是我的错误信息

我尝试重新安装一些软件包,并从starterkit修改此配置文件,但没有效果


提前谢谢

您是否配置了
.babelrc
文件?@Thinker那是什么?如何以及在何处执行此操作?在放置网页文件的根文件夹中添加名为
.babelrc
的文件,并添加以下行
{“预设”:[“env”,“react”]}
,然后运行again@Thinker它仍然不起作用。此图像是错误消息!