简体   繁体   中英

Entrypoint undefined = ./index.html

Hi I'm a fairly new programmer in webpack, I am trying to create react app using webpack. but i am getting this error.


Error

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
    }
  };

This is My Project structure

[ https://i.stack.imgur.com/ve1oa.png]

Maybe filename: "./index.html" should be filename: "index.html" ? Or just remove it

似乎此错误消息是无害的,可以忽略: html-webpack-plugin问题#895

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM