fix(docs): build failed

This commit is contained in:
Neko Ayaka
2025-06-28 00:57:41 +08:00
parent d05fce516f
commit de8335aa30
+23
View File
@@ -5,6 +5,29 @@ import UnoCSS from 'unocss/astro'
// https://astro.build/config
export default defineConfig({
site: 'https://airi.build',
vite: {
// This kind of error occurs when building astro site:
// The requested module 'nanoid/non-secure' does not provide an export named 'default'
// 12:51:31 AM: Location:
// 12:51:31 AM: /opt/build/repo/node_modules/.pnpm/astro@5.10.1_@types+node@24.0.4_encoding@0.1.13_jiti@2.4.2_less@4.3.0_lightningcss@1.30_07650979d98d2e2072de2da1f022c9b9/node_modules/astro/dist/core/build/pipeline.js:221:15
//
// Discovered these issues:
//
// [Build Error] The requested module 'x' does not provide an export named 'default' · Issue #8660 · withastro/astro
// https://github.com/withastro/astro/issues/8660
//
// Related to:
//
// - Issue when importing default from module on SSR https://github.com/vitejs/vite/issues/10712
// - CJS named imports in an ESM library https://github.com/vitejs/vite/issues/14332
//
// This is because somehow postcss related script is imported,
// and import require$$0$2 from 'nanoid/non-secure' will be
// generated, while nanoid/non-secure does not have a default export.
ssr: {
noExternal: ['nanoid'],
},
},
integrations: [
UnoCSS(),
starlight({