你好,我是一个相对新手的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
}
};
HtmlWebPackPlugin
选项中删除filename
属性,它是否有效? - Tholle