问答详情
源自:3-3 自动化生成项目中的html页面(下)

ERROR in Template execution failed: ReferenceError: htmlPlugin is not defined这是什么原因

ERROR in Template execution failed: ReferenceError: htmlPlugin is not defined这是什么原因。模板语法不能用吗? 代码如下:

<head>

    <title><%= htmlPlugin.options.title %></title>

    <meta charset="UTF-8" />

    <script src="<%= htmlPlugin.files.chunks.main.entry %>"></script>

</head>

-----------------------------

plugins:[

   new htmlPlugin({

    template:"index.html",

    filename:"index.html",

    inject:"head",

    title:"this is a.html",

    chunks:["a"]

   }),


   new htmlPlugin({

    template:"index.html",

    filename:"index.html",

    inject:"head",

    title:"this is b.html",

    chunks:["b"]


   }),


   new htmlPlugin({

    template:"index.html",

    filename:"index.html",

    inject:"head",

    title:"this is c.html",

    chunks:["c"]

   }),


 ]

<%= htmlplugin.options.title=""></%=>

提问者:sean5120scan 2018-04-20 17:25

个回答

  • qq_天空之镜_2
    2018-06-11 19:54:50

    <%= htmlWebpackPlugin.options.title %>

  • flying_birds_do
    2018-06-10 12:41:54

    你这个问题解决了么,我也有同样的问题呢

  • 慕后端4596644
    2018-04-20 22:26:42

    模板中 htmlWebpack  改为htmlWebpackPlugin