diff --git a/.gitignore b/.gitignore index d73d7b2d..802a3627 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ .idea .vite_opt_cache .vscode +.temp dist node_modules pnpm-global diff --git a/src/node/build/bundle.ts b/src/node/build/bundle.ts index ac849112..ae98f54d 100644 --- a/src/node/build/bundle.ts +++ b/src/node/build/bundle.ts @@ -54,7 +54,10 @@ export async function bundle( ), // @ts-ignore ssr: { - noExternal: ['vitepress'] + noExternal: [ + 'vitepress', + '@docsearch/css' + ] }, build: { ...options, diff --git a/src/node/build/render.ts b/src/node/build/render.ts index aa5f217e..99b28c7c 100644 --- a/src/node/build/render.ts +++ b/src/node/build/render.ts @@ -20,9 +20,12 @@ export async function renderPage( pageToHashMap: Record, hashMapString: string ) { - const { createApp } = await import( - pathToFileURL(path.join(config.tempDir, `app.js`)).toString() - ) + const entryPath = [ + path.join(config.tempDir, `app.mjs`), + path.join(config.tempDir, `app.js`) + ].find((i) => fs.existsSync(i))! + + const { createApp } = await import(pathToFileURL(entryPath).toString()) const { app, router } = createApp() const routePath = `/${page.replace(/\.md$/, '')}` const siteData = resolveSiteDataByRoute(config.site, routePath)