"AsyncLocalStorage" is not exported by "__vite-browser-external"

Installed the rc1, moved my code over, fixed up the issues coming from the v.3 release, npm run build dies with ../node_modules/vinxi/runtime/http.js (70:9): "AsyncLocalStorage" is not exported by "__vite-browser-external", imported by "../node_modules/vinxi/runtime/http.js" Any suggestions on how to fix it up? Using node v20.12.2
No description
12 Replies
Some Call Me Tim
Some Call Me TimOPā€¢7mo ago
No description
peerreynders
peerreyndersā€¢7mo ago
It suggests server code is being pulled into the client. If I remember correctly "use server" happened after v.3 so that's probably missing somewhere. edit: "use server" was introduced with v0.4.0 last December.
Some Call Me Tim
Some Call Me TimOPā€¢7mo ago
okay thanks, that's a good place to start. I'm wrapping almost everything in a <ClientOnly> as it's basically a SPA, but will do some digging.
peerreynders
peerreyndersā€¢7mo ago
Typical places would be actions; though sometimes it's a badly structured import (i.e. don't rely on treeshaking, especially in dev). The traceback of the error should lead you to the offending code (which is ultimatlely responsible for pulling in the server code).
Some Call Me Tim
Some Call Me TimOPā€¢7mo ago
that's the ugly thing, the traceback doesn't have any of my code in it:
[plugin:vite:resolve] [plugin vite:resolve] Module "node:async_hooks" has been externalized for browser compatibility, imported by "node_modules/vinxi/runtime/http.js". See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
virtual:#vinxi/handler/client (1:112): "default" is not exported by "src/entry-client.tsx", imported by "virtual:#vinxi/handler/client".
āœ“ 2685 modules transformed.
x Build failed in 10.41s

[9:46:45 AM] ERROR ../node_modules/vinxi/runtime/http.js (70:9): "AsyncLocalStorage" is not exported by "__vite-browser-external", imported by "../node_modules/vinxi/runtime/http.js".
file: node_modules/vinxi/runtime/http.js:70:9
68: import { getContext as gContext } from "unctx";
69:
70: import { AsyncLocalStorage } from "node:async_hooks";
^
[plugin:vite:resolve] [plugin vite:resolve] Module "node:async_hooks" has been externalized for browser compatibility, imported by "node_modules/vinxi/runtime/http.js". See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
virtual:#vinxi/handler/client (1:112): "default" is not exported by "src/entry-client.tsx", imported by "virtual:#vinxi/handler/client".
āœ“ 2685 modules transformed.
x Build failed in 10.41s

[9:46:45 AM] ERROR ../node_modules/vinxi/runtime/http.js (70:9): "AsyncLocalStorage" is not exported by "__vite-browser-external", imported by "../node_modules/vinxi/runtime/http.js".
file: node_modules/vinxi/runtime/http.js:70:9
68: import { getContext as gContext } from "unctx";
69:
70: import { AsyncLocalStorage } from "node:async_hooks";
^
Dev works fine, it's only on build unfortunately.
peerreynders
peerreyndersā€¢7mo ago
This error has me scratching my head:
"default" is not exported by "src/entry-client.tsx", imported by "virtual:#vinxi/handler/client"
"default" is not exported by "src/entry-client.tsx", imported by "virtual:#vinxi/handler/client"
entry-client.tsx runs mount there is no default export; though it's in build so I'm probably missing something.
GitHub
solid-start/packages/start/src/client/mount.ts at 7ff375563f74aff34...
SolidStart, the Solid app framework. Contribute to solidjs/solid-start development by creating an account on GitHub.
Some Call Me Tim
Some Call Me TimOPā€¢7mo ago
yeah, and those files are straight from the start rc1 install, I've not modified them.
peerreynders
peerreyndersā€¢7mo ago
Likely a stupid and superfluous question on my part; can you successfully build the "basic" template?
Some Call Me Tim
Some Call Me TimOPā€¢7mo ago
hehe, yeah, the start + unocss template installs and builds fine, which is the one I started with. oooh, that "default" does log in the new install as well:
šŸ“¦ Compiling client router...
vinxi building router client in client mode
vite v5.2.10 building for production...
virtual:#vinxi/handler/client (1:109): "default" is not exported by "src/entry-client.tsx", imported by "virtual:#vinxi/handler/client".
āœ“ 53 modules transformed.
šŸ“¦ Compiling client router...
vinxi building router client in client mode
vite v5.2.10 building for production...
virtual:#vinxi/handler/client (1:109): "default" is not exported by "src/entry-client.tsx", imported by "virtual:#vinxi/handler/client".
āœ“ 53 modules transformed.
seems like a red herring... The good news is that If I remove all my routes and leave a stub route, it builds, so I'm off to slowly start adding routes back 1 by 1
peerreynders
peerreyndersā€¢7mo ago
Yep, never noticed it before. I was on vite v5.2.8 but after a pnpm update nothing mysteriously broke the build.
so I'm off to slowly start adding routes back 1 by 1
Sounds like a plan
Some Call Me Tim
Some Call Me TimOPā€¢7mo ago
... and it was! Found a stray createServerAction$. Removed it, and it all compiles now šŸ˜‰
Want results from more Discord servers?
Add your server