server components (even dynamic) runs on build unexpectedly (through `unstable_collectClientModules`)
himself65 opened this issue · comments
See: himself65@5e8218f
/Users/himself65/Library/Caches/fnm_multishells/48575_1709013514281/bin/pnpm run build
> waku-starter@0.1.0 build /Users/himself65/Code/waku/examples/01_template
> DONT_LEAK_IN_BUILD_TIME=NO waku build
vite v5.1.4 building SSR bundle for production...
✓ 42 modules transformed.
✓ built in 374ms
vite v5.1.4 building SSR bundle for production...
✓ 43 modules transformed.
dist/assets/root-layout-BDx5PYJp.css 11.64 kB
dist/assets/rsc1-ddb75831a.js 0.15 kB
dist/components/header.js 0.45 kB
dist/components/counter.js 0.48 kB
dist/components/error-boundary.js 0.51 kB
dist/templates/contact-page.js 0.53 kB
dist/components/footer.js 0.71 kB
dist/templates/about-page.js 1.06 kB
dist/templates/root-layout.js 1.16 kB
dist/templates/home-page.js 1.16 kB
dist/assets/jsx-runtime.react-server-DaQipseb.js 1.25 kB
dist/assets/rsc2-19056431e.js 1.99 kB
dist/assets/rsc0-1f451937d.js 2.67 kB
dist/assets/react.react-server-BRc6Y66K.js 10.76 kB
dist/entries.js 12.98 kB
dist/rsdw-server.js 41.09 kB
✓ built in 106ms
vite v5.1.4 building for production...
✓ 40 modules transformed.
dist/public/index.html 1.01 kB │ gzip: 0.45 kB
dist/public/assets/rsc0-1f451937d.js 0.21 kB │ gzip: 0.17 kB
dist/public/assets/rsc1-ddb75831a.js 0.42 kB │ gzip: 0.31 kB
dist/public/assets/jsx-runtime-CcapePxT.js 0.63 kB │ gzip: 0.42 kB
dist/public/assets/main-A3kPowAf.js 0.73 kB │ gzip: 0.46 kB
dist/public/assets/indexHtml-DVWfb-0O.js 0.86 kB │ gzip: 0.49 kB
dist/public/assets/rsc2-19056431e.js 4.24 kB │ gzip: 1.80 kB
dist/public/assets/index-XTTFb40S.js 8.09 kB │ gzip: 3.06 kB
dist/public/assets/client-C95rG-dh.js 191.17 kB │ gzip: 60.21 kB
✓ built in 303ms
Error: SHOULD NOT LEAK
at ContactPage (file:///Users/himself65/Code/waku/examples/01_template/dist/templates/contact-page.js:9:11)
at ib (file:///Users/himself65/Code/waku/examples/01_template/dist/rsdw-server.js:573:7)
at jb (file:///Users/himself65/Code/waku/examples/01_template/dist/rsdw-server.js:592:46)
at Q (file:///Users/himself65/Code/waku/examples/01_template/dist/rsdw-server.js:711:16)
at Object.toJSON (file:///Users/himself65/Code/waku/examples/01_template/dist/rsdw-server.js:629:15)
at stringify (<anonymous>)
at nb (file:///Users/himself65/Code/waku/examples/01_template/dist/rsdw-server.js:831:53)
at kb (file:///Users/himself65/Code/waku/examples/01_template/dist/rsdw-server.js:859:7)
at Timeout._onTimeout (file:///Users/himself65/Code/waku/examples/01_template/dist/rsdw-server.js:896:12)
at listOnTimeout (node:internal/timers:573:17)
Process finished with exit code 0
Also exit code shouldn't be 0
Thanks for opening up an issue.
Yeah, it seems like a bug. Can you dig into it?
exit status 0
is also weird.
exit status
0
is also weird.
Working on this
Working on this
From what I understand #536 (comment), dist/public/index.html
isn't created if /
is not isStatic
. So, I don't see how this happens. Hope you find a bug somewhere.
inside unstable_collectClientModules
From #573, what I'd say is it's not SSR (html generation) and it's a false positive (not leaking). So, I don't consider it's a bug per se.
However, I agree it's not a desirable behavior and I wish we could come up with a different solution and eliminate unstable_
.
btw, do you have a real issue with the current non-ideal behavior?
btw, do you have a real issue with the current non-ideal behavior?
Yeah, I will use getEnv
in the runtime, there's no env var during my build time
I see. It's unfortunate, but the current workaround would be add a check if such an env var is available or not (and do some fallback that would never be required in the runtime.)
Current status: #573 (comment)