From 3b27d722079f2c9f76f9517176b01e9c2f607343 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Sat, 13 Apr 2024 15:01:55 +0900 Subject: [PATCH] wip --- packages/react-server/examples/basic/package.json | 1 + .../react-server/examples/basic/src/routes/test/error.tsx | 5 +++++ packages/react-server/examples/basic/vite.config.ts | 2 ++ pnpm-lock.yaml | 3 +++ 4 files changed, 11 insertions(+) diff --git a/packages/react-server/examples/basic/package.json b/packages/react-server/examples/basic/package.json index ca0f3fe0b..7400f03a3 100644 --- a/packages/react-server/examples/basic/package.json +++ b/packages/react-server/examples/basic/package.json @@ -30,6 +30,7 @@ "@hattip/adapter-node": "^0.0.44", "@hiogawa/unocss-preset-antd": "2.2.1-pre.7", "@hiogawa/utils": "^1.6.3", + "@hiogawa/vite-plugin-error-overlay": "latest", "@hiogawa/vite-plugin-ssr-middleware": "latest", "@iconify-json/ri": "^1.1.20", "@playwright/test": "^1.42.1", diff --git a/packages/react-server/examples/basic/src/routes/test/error.tsx b/packages/react-server/examples/basic/src/routes/test/error.tsx index 5702012dc..36b043d48 100644 --- a/packages/react-server/examples/basic/src/routes/test/error.tsx +++ b/packages/react-server/examples/basic/src/routes/test/error.tsx @@ -1,8 +1,13 @@ "use client"; import type { ErrorPageProps } from "@hiogawa/react-server/server"; +import React from "react"; export default function ErrorPage(props: ErrorPageProps) { + React.useEffect(() => { + (async () => { throw props.error; })(); + }, []); + return (

ErrorPage

diff --git a/packages/react-server/examples/basic/vite.config.ts b/packages/react-server/examples/basic/vite.config.ts index d42616e07..ec603df2f 100644 --- a/packages/react-server/examples/basic/vite.config.ts +++ b/packages/react-server/examples/basic/vite.config.ts @@ -4,6 +4,7 @@ import { vitePluginLogger, vitePluginSsrMiddleware, } from "@hiogawa/vite-plugin-ssr-middleware"; +import { vitePluginErrorOverlay } from "@hiogawa/vite-plugin-error-overlay" import react from "@vitejs/plugin-react"; import unocss from "unocss/vite"; import { type Plugin, defineConfig } from "vite"; @@ -13,6 +14,7 @@ export default defineConfig({ plugins: [ react(), unocss(), + vitePluginErrorOverlay(), vitePluginReactServer({ plugins: [ testVitePluginVirtual(), diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1ca121a11..76d3970df 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -166,6 +166,9 @@ importers: '@hiogawa/utils': specifier: ^1.6.3 version: 1.6.3 + '@hiogawa/vite-plugin-error-overlay': + specifier: latest + version: link:../../../error-overlay '@hiogawa/vite-plugin-ssr-middleware': specifier: latest version: link:../../../vite-plugin-ssr-middleware