-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
Support Waku? #208
Comments
Hi @dai-shi , I'm extremely thrilled to receive this offer. The opportunity of bringing together Waku and Kuma UI is indeed exciting and I sincerely appreciate your interest! Regarding the vite plugin issue, I'm certainly willing to explore potential solutions and assist in any way possible. I'm absolutely open to collaboration and exploring how we can make this integration happen! Waku-waku 🙌🙌 |
Waku-waku! 🤩 Here's what I tried: yarn create waku
cd waku-example
yarn add @kuma-ui/core @kuma-ui/vite
echo 'import { defineConfig } from "vite"; import KumaUI from "@kuma-ui/vite"; export default defineConfig({ plugins: [KumaUI()] });' > vite.config.js
yarn dev The error is |
I resolved the issue on the Kuma side. For more details, please refer to the following comment: Afterwards, we tested the dev server and discovered that the @kuma-ui/vite injects the style tags at runtime specifically for the dev server. Therefore, we decided to investigate by switching to the usage of virtual modules to import CSS. However, while it works in Kuma's Vite example, it doesn't work in Waku. The error message is as follows:
I believe that if virtual module support can be added on the Waku side, Kuma should work without any issues. Is it possible to add support for virtual modules? |
dai-shi/waku#103 may (or may not) help for virtual modules. btw, would you be interested in adding CodeSandbox CI in this project? It would make it easy to try a PR. |
It seems to be working with dai-shi/waku#103 and #211. |
I just learned about CodeSandbox CI, a useful GitHub app. I'll give it a try!
That's wonderful! Thank you for your efforts 💚 |
I have just installed the CodeSandbox CI App. It seems to be working well. Thanks 👍
Unfortunately, Kuma UI does not seem to work. It looks like the virtual module is not loading properly. In the Kuma's example, the virtual module is correctly imported as shown below. In Waku's example, the virtual module is not imported as shown below. Also, it appears that an error occurs when trying to generate dynamic styles. Even stranger, an error seems to occur if the string "@kuma-ui/core" exists in the Client Component. Therefore, the Kuma UI cannot be used in the Client Component 🙏 "use client";
import { useState } from "react";
+ // @kuma-ui/core
export const Counter = () => {
const [count, setCount] = useState(0);
return (
<div style={{ border: "3px blue dashed", margin: "1em", padding: "1em" }}>
<p>Count: {count}</p>
<button onClick={() => setCount((c) => c + 1)}>Increment</button>
<h3>This is a client component.</h3>
</div>
);
}; I checked them with this example: https://github.com/kotarella1110-sandbox/waku-kuma-ui-example |
Thanks for trying. Should the virtual module be imported on client bundle, or server bundle? It's tricky because Waku uses Vite twice (or more) for RSC and for dev server. I will try your reproduction. Current status
|
So, the first problem is even if we have Even if I manually add the import statement in main.tsx, it causes an error: I think this is also the problem with CSS Modules: Use css in a server component, and add the css file on client files. |
dai-shi/waku#103 is merged and dai-shi/waku#106 is opened. Edit 1: Fixed something but the virtual module is |
Thanks. I wil investigate it 👍 |
@dai-shi |
There seems to be an issue in Waku's ssr middleware. Please try this: diff --git a/package.json b/package.json
index e99e0e1..820d083 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
"type": "module",
"private": true,
"scripts": {
- "dev": "waku dev --with-ssr",
+ "dev": "waku dev",
"build": "waku build",
"start": "waku start --with-ssr"
}, |
Waku has been improved quite a lot since then. |
Thanks for the update! |
I attempted to launch the waku project before confirming integration with Kuma UI by executing the following commands: pnpm create waku
cd waku-project
pnpm install
pnpm dev However, it seems that the following error occurred: > [email protected] dev /Users/kotarella1110/Develop/sandbox/waku-project
> waku dev --with-ssr
file:///Users/kotarella1110/Develop/sandbox/waku-project/node_modules/.pnpm/@[email protected]/node_modules/@hono/node-server/dist/index.mjs:123
Object.setPrototypeOf(Response2, GlobalResponse);
^
TypeError: Object prototype may only be an Object or null: undefined
at Function.setPrototypeOf (<anonymous>)
at file:///Users/kotarella1110/Develop/sandbox/waku-project/node_modules/.pnpm/@[email protected]/node_modules/@hono/node-server/dist/index.mjs:123:8
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:526:24)
at async loadESM (node:internal/process/esm_loader:91:5)
at async handleMainPromise (node:internal/modules/run_main:65:12)
ELIFECYCLE Command failed with exit code 1. Do you know what might be causing this issue? |
I've never seen it. What's your Node.js version? |
Oops, I apologize 🙏 |
I have installed the latest Waku and Kuma UI: kuma-ui/waku-kuma-ui-example#1
When you remove the line importing the virtual CSS module in - return `import "${url}";
- ` + result.code;
+ return result.code; Is there a good way to resolve this? |
Is the line importing dai-shi/waku#215 this might help. |
There have been multiple improvements in the Waku side. |
Waku is an ongoing project to develop a React Server Component based framework. It would be super nice if we can support Waku+Kuma UI.
At a glance, there seems to be an issue with vite plugin which can't be resolvable on the Waku end. Though, Waku's support for CSS is still work in progress, so there might be potential challenges somewhere.
Just dropping a note to see if there could be a collaboration.
The text was updated successfully, but these errors were encountered: