diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 8dff7daf..8ef0d400 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -3,6 +3,14 @@ export default { title: 'VitePress', description: 'Vite & Vue powered static site generator.', + head: [ + [ + 'script', + {}, + '(() => { const afsefe = window.foo;\n console.log(afsefe);})()' + ] + ], + themeConfig: { repo: 'vuejs/vitepress', docsDir: 'docs', diff --git a/src/node/build/render.ts b/src/node/build/render.ts index ae851343..8bfe54d5 100644 --- a/src/node/build/render.ts +++ b/src/node/build/render.ts @@ -2,7 +2,7 @@ import path from 'path' import fs from 'fs-extra' import { SiteConfig, resolveSiteDataByRoute } from '../config' import { HeadConfig } from '../shared' -import { normalizePath } from 'vite' +import { normalizePath, transformWithEsbuild } from 'vite' import { RollupOutput, OutputChunk, OutputAsset } from 'rollup' import { slash } from '../utils/slash' import escape from 'escape-html' @@ -121,7 +121,7 @@ export async function renderPage( ${stylesheetLink} ${preloadLinksString} ${prefetchLinkString} - ${renderHead(head)} + ${await renderHead(head)}