dai-shi / waku

⛩️ The minimal React framework
https://waku.gg
MIT License
4.01k stars 104 forks source link

not compatible with `@vanilla-extract/css` #59

Closed himself65 closed 5 months ago

himself65 commented 12 months ago

See https://github.com/Himself65/affine-waku/tree/css-issue

dai-shi commented 12 months ago

does it emit for client bundle but not for server bundle?

himself65 commented 12 months ago

does it emit for client bundle but not for server bundle?

Both not be emitted, I'm now debugging it.

himself65 commented 12 months ago

It's weird when running waku source code. I think it might need some improvement on DX

dai-shi commented 12 months ago

Not sure if I follow, but I agree there are tons of room for improvement in terms of Waku's DX.

dai-shi commented 12 months ago

Both not be emitted

That's unfortunate. I hoped it would at least work for client.

himself65 commented 12 months ago

Sorry, my mistake. I tried it again.

The issue is:

himself65 commented 12 months ago

It think generates the wrong output code

// App-88e67fcf.js
import { jsxDEV } from "react/jsx-dev-runtime";
import { Counter } from "./rsc0.js";
import { Suspense } from "react";
import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
import { style } from "@vanilla-extract/css";
setFileScope("src/App.css.ts", "affine-waku");
const container = style(
  { border: "3px red dashed", margin: "1em", padding: "1em" }
);
style(
  { border: "3px blue dashed", margin: "1em", padding: "1em" }
);
endFileScope();
const App = ({ name = "Anonymous" }) => {
  return /* @__PURE__ */ jsxDEV("div", { className: container, children: [
    /* @__PURE__ */ jsxDEV("h1", { children: [
      "Hello ",
      name,
      "!!"
    ] }, void 0, true, {
      fileName: "/Users/himself65/Code/affine-waku/src/App.tsx",
      lineNumber: 8,
      columnNumber: 7
    }, globalThis),
    /* @__PURE__ */ jsxDEV("h3", { children: "This is a server component." }, void 0, false, {
      fileName: "/Users/himself65/Code/affine-waku/src/App.tsx",
      lineNumber: 9,
      columnNumber: 7
    }, globalThis),
    /* @__PURE__ */ jsxDEV(Suspense, { fallback: "loading...", children: /* @__PURE__ */ jsxDEV(Counter, {}, void 0, false, {
      fileName: "/Users/himself65/Code/affine-waku/src/App.tsx",
      lineNumber: 11,
      columnNumber: 9
    }, globalThis) }, void 0, false, {
      fileName: "/Users/himself65/Code/affine-waku/src/App.tsx",
      lineNumber: 10,
      columnNumber: 7
    }, globalThis)
  ] }, void 0, true, {
    fileName: "/Users/himself65/Code/affine-waku/src/App.tsx",
    lineNumber: 7,
    columnNumber: 5
  }, globalThis);
};
export {
  App as default
};
dai-shi commented 12 months ago

that looks tough...

dai-shi commented 10 months ago

106 includes something related to this.

Can you check what happens with the latest version v0.14.0?

himself65 commented 10 months ago

OK

dai-shi commented 7 months ago

@himself65 please check this too. 🙏

himself65 commented 7 months ago

not working still

see https://github.com/himself65/waku-ecosystem/tree/main/playground/waku-vanilla-extract-css

dai-shi commented 7 months ago

That's unfortunate...

himself65 commented 7 months ago

I try in the latest version. It also now cannot run in the client component

dai-shi commented 7 months ago

Hoped to support react-tweet #90 too, but it still doesn't. We need someone to help on it.

himself65 commented 7 months ago

I guess there might be because of the config plugins missing or something

dai-shi commented 6 months ago

For #90, it seems to work for build, but for dev, vite doesn't understand .css in node_modules. There must be something to do with Vite config.

Aslemammad commented 6 months ago

I'm putting some time on this and I'll let you know my findings.