vite-plugin-html
vite-plugin-html copied to clipboard
vite5之后 tags 插入script标签不起作用
{
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",
}
]
一样,陪等