diff --git a/esa.jsonc b/esa.jsonc index 91c63a0..c643c1a 100644 --- a/esa.jsonc +++ b/esa.jsonc @@ -1,7 +1,7 @@ { "name": "easyimg", "installCommand": "pnpm install", - "buildCommand": "npm run generate", + "buildCommand": "pnpm run generate", "assets": { "directory": "./.output/public", "notFoundStrategy": "singlePageApplication" diff --git a/nuxt.config.js b/nuxt.config.js index cc40fbe..408438b 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -57,6 +57,16 @@ export default defineNuxtConfig({ 'Access-Control-Allow-Headers': 'Content-Type, Authorization, X-API-Key' } } + }, + // 预渲染完成后强制退出进程 + // 这是为了解决某些模块(如数据库连接、定时器)可能保持进程活跃的问题 + hooks: { + 'prerender:done'() { + console.log('[Nitro] 预渲染完成,退出进程...') + setTimeout(() => { + process.exit(0) + }, 1000) + } } },