vite-plugin-html icon indicating copy to clipboard operation
vite-plugin-html copied to clipboard

vite5之后 tags 插入script标签不起作用

Open ilxqx opened this issue 1 year ago • 1 comments

{
      tag: "script",
      attrs: {
        type: "module",
        crossorigin: true,
        src: "app.config.js",
      },
      injectTo: "head-prepend",
    }
使用这种方法插入script标签不起作用,我不知道啥原因,求大佬解惑
环境:vite5.1.4 + vite-plugin-html:3.2.2

创建插件代码:

    createHtmlPlugin({
        minify: false,
        entry: "src/main.ts",
        template: "index.html",
        inject: {
          data: {
            title: "xxx",
            favicon: "/static/images/layout-header-logo.svg",
            themeColor: defaultTheme.primaryColor,
          },
          tags: htmlTags,
        },
        verbose: true,
      }),

htmlTags 就是:

      [
{
      tag: "script",
      attrs: {
        type: "module",
        crossorigin: true,
        src: "app.config.js",
      },
      injectTo: "head-prepend",
    }
]

ilxqx avatar Feb 22 '24 02:02 ilxqx

一样,陪等

shinehs avatar Jun 20 '24 06:06 shinehs