vuecli3.0 htmlWebpackPlugin 报 ReferenceError: BASE_URL is not defined 错误

时间:2019-11-27 19:42:47   收藏:0   阅读:3172

<head>   

<link rel="icon" href="<%= BASE_URL %>favicon.ico"> // 这里BASE_URL报错

</head>

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

vue.config.js

config.plugins.push(
      new HtmlWebpackPlugin({
        template: ‘./public/index.html‘,
        inject: true,
        hash: new Date().getTime(),
        url: BASE_URL,  //需要这里传参
        minify: {
          removeComments: true,
          collapseWhitespace: true,
          removeAttributeQuotes: true
        },
        chunksSortMode: ‘manual‘
      })
    )
 
--------------------------------

<head>   

<link rel="icon" href="<%= htmlWebpackPlugin.options.url %>favicon.ico"> //改成这种就ok了

</head>

原文:https://www.cnblogs.com/ctb-web/p/11944467.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!