From 3bd48e304463fea8b1d038486387429310b4fe5b Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Mon, 5 Sep 2022 11:39:24 +0200 Subject: [PATCH 1/2] feat: add static `prerender` env variable --- src/rollup/config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rollup/config.ts b/src/rollup/config.ts index 028161d943..a0291b590c 100644 --- a/src/rollup/config.ts +++ b/src/rollup/config.ts @@ -138,6 +138,7 @@ export const getRollupConfig = (nitro: Nitro) => { // Build-time environment variables const buildEnvVars = { NODE_ENV: nitro.options.dev ? 'development' : (nitro.options.preset === 'nitro-prerender' ? 'prerender' : 'production'), + prerender: nitro.options.preset === 'nitro-prerender', server: true, client: false, dev: String(nitro.options.dev), From b0a3f43b22ec3c2e6aff8238594b508f7ae6e661 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Mon, 5 Sep 2022 11:55:18 +0200 Subject: [PATCH 2/2] fix(types): allow `EventHandler` type for dev handlers --- src/types/handler.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/types/handler.ts b/src/types/handler.ts index 4191851517..644285f01d 100644 --- a/src/types/handler.ts +++ b/src/types/handler.ts @@ -1,4 +1,4 @@ -import type { Handler, CompatibilityEvent, H3Error } from 'h3' +import type { Handler, EventHandler, CompatibilityEvent, H3Error } from 'h3' export interface NitroEventHandler { /** @@ -41,7 +41,7 @@ export interface NitroDevEventHandler { * Event handler * */ - handler: Handler + handler: Handler | EventHandler } export type NitroErrorHandler = (error: H3Error, event: CompatibilityEvent) => void | Promise