角度8:未定义文档错误:入口点= index.html

时间:2019-08-17 14:01:12

标签: angular

文档中的错误未定义 用于“ index.html”的入口点html-webpack-plugin = index.html

这是用于Windows操作系统。我正在使用“ html-webpack-plugin”:“ 3.0.7”

const HtmlWebPackPlugin = require("html-webpack-plugin");


module.exports = function() {
  return {
    entry: "./src/main.ts",    
    output: {
      path: __dirname + "/dist",
      filename: "app.js"
    },
    resolve: {
      extensions: [".ts", ".js"]
    },
    module: {
      rules: [
        { test: /\.ts$/, loader: "@ngtools/webpack" },
        { test: /\.html$/, loader: "html-loader" }        
      ]
    },
    plugins: [
      new HtmlWebPackPlugin({
        template: __dirname + "/src/index.html",
        output: __dirname + "/dist",
        filename: "index.html",
        inject: "head",
        title: "My Demo Application"        
      }),
      new ScriptExtPlugin({
        defaultAttribute: "defer"
      }),
      new AngularCompilerPlugin({
        tsConfigPath: "./tsconfig.json",
        entryModule: "./src/app/app.module#AppModule",
        sourceMap: true
      })
    ]
  };
};

使用Webpack无法成功构建

0 个答案:

没有答案