Replies: 1 comment 2 replies
-
|
Awesome! thanks for sharing the journey of upgrade! May I ask a few things?
We changed
If it's working before, it should be possible to make it work. Can you provide a reproduction? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I learned a few days ago that Waku already migrated to the new Vite RSC plugin. Congrats team!
I was able to go from 0.23.2 -> 0.25.0 with relatively few changes (surprisingly), which is a testament to Waku's design.
But as with any build tool upgrade, of course there had to be a few things break for the last 10-20%. I wanted to share my learnings here. This is mostly about Vite-related config and how it relates to Cloudflare builds, where I know people like to deploy Waku.
Context
package.json
Amongst other things, I used the following pnpm overrides setup for the upgrade. I'm not entirely sure if it is even necessary as Waku already uses @vitejs/plugin-react v5 - which I think now uses Rolldown by default? Anyway, it ensures that the environment is as consistent as possible.
waku.config.ts
Here's the main fix I needed for the nastiest build & server runtime errors:
I discovered the
platformoption from this comment.Before upgrading Waku/Vite RSC plugin/Rolldown, whatever heuristic my npm deps were using to detect if they were building for Cloudflare Workers seemed to work by default. With the Vite environment API, however, setting it to "neutral" appears to be essential for ensuring that deps with multi-env build configs correctly detect that they're building for Cloudflare's workerd environment. Also note that I added
resolve.conditionsbut this probably isn't necessary.React Compiler
I just copied the solution from here (thanks again!) Add it to
vite.pluginsinwaku.config.ts:Other Notes
build.rollupOptions.treeshake.moduleSideEffects: falsein my Vite config. This was a needle in the haystack and caused a runtime error__vite_rsc_require__ is not definedwhen upgrading. Removing this option fixed the error.confighook. This stopped working but didn't affect the build. This is because the module runner lifecycle for plugins has changed in rolldown.requirerelated errors at build time. For now I've just commented it out to get a working build.Final Thoughts
Beta Was this translation helpful? Give feedback.
All reactions