将html-webpack-plugin和favicons-webpack-plugin与craco一起使用,但不能在index.html上使用

问题描述

你好,谢谢阅读。

因此,我想使用html-webpack-pluginfavicons-webpack-plugin的组合将清单图标和不同分辨率的图标图标注入我的应用程序。

我正在尝试使用此配置

/* craco.config.js */
const HtmlWebpackPlugin = require("html-webpack-plugin");
const FaviconsWebpackPlugin = require("favicons-webpack-plugin");

module.exports = {
  babel: {
    plugins: [["@babel/plugin-proposal-decorators",{ legacy: true }]],},webpack: {
    plugins: [
      new HtmlWebpackPlugin({
        title: "My App",template: "./public/index.html",filename: "admin.html",meta: {
          viewport: "width=device-width,initial-scale=1,shrink-to-fit=no",// Will generate: <meta name="viewport" content="width=device-width,shrink-to-fit=no">
          "theme-color": "#4285f4",// Will generate: <meta name="theme-color" content="#4285f4">
        },}),new HtmlWebpackPlugin({
        title: "My App",filename: "admin2.html",filename: "index.html",new FaviconsWebpackPlugin({
        logo: "./src/logo.svg",// svg works too!
        prefix: "icons/",inject: true,favicons: {
          appName: "my-app",appDescription: "My awesome App",developerName: "Me",developerURL: null,// prevent retrieving from the nearest package.json
          background: "#ddd",theme_color: "#333",icons: {
            coast: false,yandex: false,],};

测试导致了奇怪的意外结果。在admin和admin2文档中,结果是预期的结果,但在索引上,似乎我的插件被覆盖了。

enter image description here

我不确定是否做错了,这是我第一次与craco合作。提前谢谢你

您可以在https://github.com/GunB/PageGroup-Test-0520/tree/1-Layout上查看我的仓库

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...