From de8335aa306c067c6a4cdee53d0cff1efbe5c379 Mon Sep 17 00:00:00 2001 From: Neko Ayaka Date: Sat, 28 Jun 2025 00:57:41 +0800 Subject: [PATCH] fix(docs): build failed --- docs/astro.config.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/astro.config.ts b/docs/astro.config.ts index a3142e1f1..2a647dd57 100644 --- a/docs/astro.config.ts +++ b/docs/astro.config.ts @@ -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({