微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决将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 举报,一经查实,本站将立刻删除。