Javascript 使用Web包运行React应用程序时出现的问题
这段代码是我的webpack.config.js文件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
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它仍然不起作用。此图像是错误消息!