From f5efadca393939e9bece07e4201e307c1478d835 Mon Sep 17 00:00:00 2001 From: daishi Date: Wed, 3 Jan 2024 22:57:56 +0900 Subject: [PATCH] chore: avoid website issues --- packages/waku/src/lib/handlers/handler-dev.ts | 2 -- packages/waku/src/lib/plugins/vite-plugin-rsc-transform.ts | 5 ++++- packages/website/package.json | 2 +- packages/website/src/components/modal.tsx | 3 +-- packages/website/vite.config.ts | 3 ++- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/waku/src/lib/handlers/handler-dev.ts b/packages/waku/src/lib/handlers/handler-dev.ts index 47a25ea93..d4cce8c19 100644 --- a/packages/waku/src/lib/handlers/handler-dev.ts +++ b/packages/waku/src/lib/handlers/handler-dev.ts @@ -15,7 +15,6 @@ import { getSsrConfigWithWorker, registerModuleCallback, } from './dev-worker-api.js'; -import { nonjsResolvePlugin } from '../plugins/vite-plugin-nonjs-resolve.js'; import { patchReactRefresh } from '../plugins/patch-react-refresh.js'; import { rscIndexPlugin } from '../plugins/vite-plugin-rsc-index.js'; import { @@ -52,7 +51,6 @@ export function createHandler< exclude: ['waku'], }, plugins: [ - nonjsResolvePlugin(), patchReactRefresh(viteReact()), rscIndexPlugin(config), rscHmrPlugin(), diff --git a/packages/waku/src/lib/plugins/vite-plugin-rsc-transform.ts b/packages/waku/src/lib/plugins/vite-plugin-rsc-transform.ts index 55bb96f6e..f2f351994 100644 --- a/packages/waku/src/lib/plugins/vite-plugin-rsc-transform.ts +++ b/packages/waku/src/lib/plugins/vite-plugin-rsc-transform.ts @@ -37,7 +37,10 @@ export function rscTransformPlugin( }; return { name: 'rsc-transform-plugin', - async transform(code, id) { + async transform(code, id, options) { + if (!options?.ssr) { + return; + } const resolve = async ( specifier: string, { parentURL }: { parentURL: string }, diff --git a/packages/website/package.json b/packages/website/package.json index 682ad52fc..02fd66bf7 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -5,7 +5,7 @@ "type": "module", "private": true, "scripts": { - "dev": "waku dev --with-ssr", + "dev": "waku dev", "build": "waku build --with-ssr", "start": "waku start --with-ssr" }, diff --git a/packages/website/src/components/modal.tsx b/packages/website/src/components/modal.tsx index 560b9a805..08ddc65f6 100644 --- a/packages/website/src/components/modal.tsx +++ b/packages/website/src/components/modal.tsx @@ -1,6 +1,5 @@ 'use client'; -import { Fragment } from 'react'; import type { ReactNode } from 'react'; import { useClickAway } from '@uidotdev/usehooks'; @@ -13,7 +12,7 @@ type ModalProps = { export const Modal = ({ isOpen, onClose, children }: ModalProps) => { const ref: any = useClickAway(onClose); - if (!isOpen) return ; + if (!isOpen) return null; return (
diff --git a/packages/website/vite.config.ts b/packages/website/vite.config.ts index 2678bf619..499c82ab1 100644 --- a/packages/website/vite.config.ts +++ b/packages/website/vite.config.ts @@ -4,7 +4,8 @@ export default defineConfig(({ mode }) => { if (mode === 'development') { return { optimizeDeps: { - include: ['@uidotdev/usehooks'], + // FIXME this causes an error with `--with-ssr` + // include: ['@uidotdev/usehooks'], }, ssr: { external: ['next-mdx-remote'],