gpt4 book ai didi

reactjs - 入口点未定义 = ./index.html

转载 作者:行者123 更新时间:2023-12-04 06:16:19 24 4
gpt4 key购买 nike

大家好,我是 webpack 的新程序员,我正在尝试使用 webpack 创建 React 应用程序。但是我收到了这个错误。


错误

Child html-webpack-plugin for "index.html":
1 asset
Entrypoint undefined = ./index.html

webpack.config.js

[![const HtmlWebPackPlugin = require("html-webpack-plugin");
const path = require('path')

const htmlPlugin = new HtmlWebPackPlugin({
template: "./src/index.html",
filename: "./index.html"
});
module.exports = {
entry: "index.js",
output: {
path: path.resolve('dist'),
filename: 'bundle.js'
},
module: {
rules: \[
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
"presets": \["env", "react"\]
}
}
}
\]
},
plugins: \[htmlPlugin\],
devServer: {
contentBase: './dist',
hot: true
}
};

这是我的项目结构

[ /image/ve1oa.png]

最佳答案

也许 filename: "./index.html" 应该是 filename: "index.html" ?或者只是删除它

关于reactjs - 入口点未定义 = ./index.html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55338323/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com