Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ilxqx opened this issue Feb 22, 2024 · 0 comments
Open

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

ilxqx opened this issue Feb 22, 2024 · 0 comments

Comments

@ilxqx
Copy link

ilxqx commented Feb 22, 2024

{
      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",
    }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant