TypeError: hook is not a function
at applyHtmlTransforms (file:///Users/xxx/projects/node_modules/vite/dist/node/chunks/dep-2faf2534.js:43464:27)
at Object.generateBundle (file:///Users/xxx/projects/node_modules/vite/dist/node/chunks/dep-2faf2534.js:43384:32)
at file:///Users/xxx/projects/node_modules/rollup/dist/es/shared/node-entry.js:25544:40
node version: v16.20.2
vite/dist/node/chunks/dep-2faf2534.js:43464:27
part code ↓
for (const hook of hooks) {
const res = await hook(html, ctx);
if (!res) {
continue;
}
if (typeof res === 'string') {
html = res;
}
else {
let tags;
if (Array.isArray(res)) {
tags = res;
}
else {
html = res.html || html;
tags = res.tags;
}
const headTags = [];
const headPrependTags = [];
const bodyTags = [];
const bodyPrependTags = [];
for (const tag of tags) {
if (tag.injectTo === 'body') {
bodyTags.push(tag);
}
else if (tag.injectTo === 'body-prepend') {
bodyPrependTags.push(tag);
}
else if (tag.injectTo === 'head') {
headTags.push(tag);
}
else {
headPrependTags.push(tag);
}
}
html = injectToHead(html, headPrependTags, true);
html = injectToHead(html, headTags);
html = injectToBody(html, bodyPrependTags, true);
html = injectToBody(html, bodyTags);
}
}
return html;
}
node version: v16.20.2
vite/dist/node/chunks/dep-2faf2534.js:43464:27 part code ↓
package.json: