Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: avoid website issues #345

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/waku/src/lib/handlers/handler-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -52,7 +51,6 @@ export function createHandler<
exclude: ['waku'],
},
plugins: [
nonjsResolvePlugin(),
patchReactRefresh(viteReact()),
rscIndexPlugin(config),
rscHmrPlugin(),
Expand Down
5 changes: 4 additions & 1 deletion packages/waku/src/lib/plugins/vite-plugin-rsc-transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
2 changes: 1 addition & 1 deletion packages/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
3 changes: 1 addition & 2 deletions packages/website/src/components/modal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use client';

import { Fragment } from 'react';
import type { ReactNode } from 'react';
import { useClickAway } from '@uidotdev/usehooks';

Expand All @@ -13,7 +12,7 @@ type ModalProps = {
export const Modal = ({ isOpen, onClose, children }: ModalProps) => {
const ref: any = useClickAway(onClose);

if (!isOpen) return <Fragment />;
if (!isOpen) return null;

return (
<div className="fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-8">
Expand Down
3 changes: 2 additions & 1 deletion packages/website/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Comment on lines +7 to +8
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to make website work in development in both with and without --with-ssr.

},
ssr: {
external: ['next-mdx-remote'],
Expand Down
Loading