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

Bug: [DEV only] waku app with vanilla-extract #953

Open
ojj1123 opened this issue Oct 6, 2024 · 5 comments
Open

Bug: [DEV only] waku app with vanilla-extract #953

ojj1123 opened this issue Oct 6, 2024 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@ojj1123
Copy link
Contributor

ojj1123 commented Oct 6, 2024

Background

I was migrating waku app into [email protected] with vanilla-extract. I encountered this error:

> waku dev

ready: Listening on http://localhost:3000/
Cannot process SSR ReferenceError: __vanilla_globalCssAdapter__ is not defined
    at eval (/Users/jeongjin/GitHub/waku-vanilla/src/components/styles.css.ts:7:34)
    at async instantiateModule (file:///Users/jeongjin/GitHub/waku-vanilla/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-CDnG8rE7.js:52915:5) {
  plugin: 'rsc-delegate-plugin',
  id: '/Users/jeongjin/GitHub/waku-vanilla/src/pages/index.tsx',
  pluginCode: 'import { jsxDEV } from "react/jsx-dev-runtime";\n' +
    'import { Link } from "waku";\n' +
    'import { Counter } from "../components/counter";\n' +
    'import { container } from "../components/styles.css";\n' +
    'export default async function HomePage() {\n' +
    '  const data = await getData();\n' +
    '  return /* @__PURE__ */ jsxDEV("div", { className: container, children: [\n' +
...
}
node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

ReferenceError: __vanilla_globalCssAdapter__ is not defined
    at eval (/Users/jeongjin/GitHub/waku-vanilla/src/components/styles.css.ts:7:34)
    at async instantiateModule (file:///Users/jeongjin/GitHub/waku-vanilla/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-CDnG8rE7.js:52915:5) {
  plugin: 'rsc-delegate-plugin',
  id: '/Users/jeongjin/GitHub/waku-vanilla/src/pages/index.tsx',
  pluginCode: 'import { jsxDEV } from "react/jsx-dev-runtime";\n' +
    'import { Link } from "waku";\n' +
    'import { Counter } from "../components/counter";\n' +
    'import { container } from "../components/styles.css";\n' +
    'export default async function HomePage() {\n' +
    '  const data = await getData();\n' +
    '  return /* @__PURE__ */ jsxDEV("div", { className: container, children: [\n' +
...
}

How to reproduce

This is reproduction of this issue.
https://github.com/ojj1123/repro-waku-vanilla-extract

  1. pnpm install
  2. pnpm dev
  3. open http://localhost:3000/
  4. you can see this and check out your console error:

스크린샷 2024-10-06 16 49 26

Additional Contexts

  • This issue is only on Dev mode(pnpm dev). I tried to do pnpm build and pnpm start, but there were no issues.
  • I've investigated for this issue
@dai-shi
Copy link
Owner

dai-shi commented Oct 6, 2024

Is #750 somehow related?

@ojj1123
Copy link
Contributor Author

ojj1123 commented Oct 6, 2024

My issue also work well when using client component.

@dai-shi dai-shi added the help wanted Extra attention is needed label Oct 6, 2024
@ojj1123
Copy link
Contributor Author

ojj1123 commented Oct 6, 2024

It could be upstream issue.

Btw, What is rsc-delegate-plugin?

@dai-shi
Copy link
Owner

dai-shi commented Oct 6, 2024

I think you've asked it before, but anyway, it's a way to bridge our two vite servers for delegating hot reloads.

@ojj1123
Copy link
Contributor Author

ojj1123 commented Oct 19, 2024

I'm investigating to resolve this issue, but I'm gonna take some time 😅
I guess waku doesn't deal with outputs of @vanilla-extract/vite-plugin properly. And I found something:

-import { container } from "../components/styles.css"
+import { container } from "../components/styles.css.js"

When I did like this, It has no error but there are no styles at all(including tailwindcss). It means no css is being injected to html on dev mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants