【问题标题】:URIError: Failed to decode param '%PUBLIC_URL%/manifest.json'URIError:无法解码参数“%PUBLIC_URL%/manifest.json”
【发布时间】:2020-04-22 14:24:32
【问题描述】:

我在使用 webpack 运行应用程序时遇到问题,我有这个错误:

URIError: Failed to decode param '/%PUBLIC_URL%/manifest.json'
    at decodeURIComponent (<anonymous>)

我试图解决这个问题,比如为 favicon 解决的问题,但它对我不起作用

plugins: [
        new HtmlWebpackPlugin({
            favicon: "./public/favicon.ico",
            filename: "index.html",
            manifest: "./public/manifest.json"
        })
    ],

我希望索引文件可以读取 /%PUBLIC_URL%/ 的值。我该怎么办?

【问题讨论】:

    标签: manifest.json


    【解决方案1】:

    像这样配置 webpack 后:

    HtmlWebpackPlugin ({
        favicon: "./public/favicon.ico",
        filename: "index.html",
        manifest: "./public/manifest.json"
    }).
    

    在 index.html 中留下这样的清单链接:

    <link rel = "manifest" href = "manifest.json" />
    

    它对我有用。

    【讨论】:

      猜你喜欢
      • 2021-03-03
      • 2018-11-22
      • 2017-12-08
      • 2019-03-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多