dai-shi/waku

Support `react-tweet`

dai-shi opened this issue · 10 comments

If we wanted to use https://github.com/vercel-labs/react-tweet, CSS Modules should be supported on server.

Currently, it shows some errors with Vite ssrLoadModule. Fixed in #98 and WIP #105

We still have issues. Can anyone help?

What is the error? I think the logic here is to collect *.module.css files and append them to response html?

ssrLoadModule doesn't understand .module.css extension. It would be the easiest if we can simply ignore it.

Here's the error message. My expectation is that Waku doesn't handle the logic directly, but instead let Vite do it.

[vite] Error when evaluating SSR module /src/components/App.tsx: failed to import "/src/components/App.module.css"
|- TypeError: Cannot read properties of undefined (reading 'set')
    at TransformContext.transform (file:///.../waku/node_modules/.pnpm/vite@4.3.9_@types+node@20.3.1/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:37919:29)
    at async Object.transform (file:///.../waku/node_modules/.pnpm/vite@4.3.9_@types+node@20.3.1/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:42919:30)
    at async loadAndTransform (file:///.../waku/node_modules/.pnpm/vite@4.3.9_@types+node@20.3.1/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53385:29)

with #98 the error is gone, but there are no styles.

I will create a follow-up issue for #98 to support bare css modules.

#105 is created and this issue is specific to support react-tweet.

It seems to somewhat work for production build, but not for dev mode. We need someone who is familiar with Vite to help.

#171 This might fix this.

Looking forward to it!

I'll work on this tomorrow! It's a matter of seeing if it works or not :)