You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Some server-side modules incorrectly bundled into the client? #5738
Starting with @tanstack/react-start@1.134.7, I think server-side modules are being incorrectly bundled into the client bundle. For example, in the Clerk SDK, this error shows up in the browser console when running dev server:
I'm getting this error for swr which is a dependency of Clerk. Uncaught (in promise) SyntaxError: The requested module 'http://localhost:3000/node_modules/use-sync-external-store/shim/index.js?v=f1295605' doesn't provide an export named: 'useSyncExternalStore'
The index.js is for node_modules/swr/dist/index.mjs. Note that this is not imported by tanstack form but only clerk for me.
If I understand #5726 correctly it only affects tanstacks internal libraries and not others.
Reacted by Daniel David Sintimbrean, Alan Cohen, Moritz, Dru Sellers, Aaron Hammer, Itta Funahashi, Ben Gale, Michael Wills, dominictobias and Muhammad Mufti Muflihun
I'm getting this error for swr which is a dependency of Clerk. Uncaught (in promise) SyntaxError: The requested module 'http://localhost:3000/node_modules/use-sync-external-store/shim/index.js?v=f1295605' doesn't provide an export named: 'useSyncExternalStore'
The index.js is for node_modules/swr/dist/index.mjs. Note that this is not imported by tanstack form but only clerk for me.
$ bun why swr
swr@2.3.4
└─ @clerk/shared@3.31.0 (requires 2.3.4)
├─ @clerk/backend@2.19.3 (requires ^3.31.0)
│ └─ @clerk/tanstack-react-start@0.26.7 (requires ^2.19.3)
If I understand #5726 correctly it only affects tanstacks internal libraries and not others.
I'm getting this same issue, and its coming from clerk. Did you find a fix?
I'm getting this error for swr which is a dependency of Clerk. Uncaught (in promise) SyntaxError: The requested module 'http://localhost:3000/node_modules/use-sync-external-store/shim/index.js?v=f1295605' doesn't provide an export named: 'useSyncExternalStore'
The index.js is for node_modules/swr/dist/index.mjs. Note that this is not imported by tanstack form but only clerk for me.
$ bun why swr
swr@2.3.4
└─ @clerk/shared@3.31.0 (requires 2.3.4)
├─ @clerk/backend@2.19.3 (requires ^3.31.0)
│ └─ @clerk/tanstack-react-start@0.26.7 (requires ^2.19.3)
If I understand #5726 correctly it only affects tanstacks internal libraries and not others.
I'm getting this same issue, and its coming from clerk. Did you find a fix?
I solved it now by using the same approach with optimizeDeps like the PR I linked.
In my vite.config.ts I added these
I'm getting this error for swr which is a dependency of Clerk. Uncaught (in promise) SyntaxError: The requested module 'http://localhost:3000/node_modules/use-sync-external-store/shim/index.js?v=f1295605' doesn't provide an export named: 'useSyncExternalStore'
The index.js is for node_modules/swr/dist/index.mjs. Note that this is not imported by tanstack form but only clerk for me.
$ bun why swr
swr@2.3.4
└─ @clerk/shared@3.31.0 (requires 2.3.4)
├─ @clerk/backend@2.19.3 (requires ^3.31.0)
│ └─ @clerk/tanstack-react-start@0.26.7 (requires ^2.19.3)
If I understand #5726 correctly it only affects tanstacks internal libraries and not others.
to me the fix was to rollback @tanstack/react-start to 1.134.6. Any other combinations of optimizeDeps and what not unfortunately did not work at all.
I'm getting this error for swr which is a dependency of Clerk. Uncaught (in promise) SyntaxError: The requested module 'http://localhost:3000/node_modules/use-sync-external-store/shim/index.js?v=f1295605' doesn't provide an export named: 'useSyncExternalStore'
The index.js is for node_modules/swr/dist/index.mjs. Note that this is not imported by tanstack form but only clerk for me.
$ bun why swr
swr@2.3.4
└─ @clerk/shared@3.31.0 (requires 2.3.4)
├─ @clerk/backend@2.19.3 (requires ^3.31.0)
│ └─ @clerk/tanstack-react-start@0.26.7 (requires ^2.19.3)
If I understand #5726 correctly it only affects tanstacks internal libraries and not others.
to me the fix was to rollback @tanstack/react-start to 1.134.6. Any other combinations of optimizeDeps and what not unfortunately did not work at all.
I have the same problem trying to use work os with start. Rolling back @tanstack/react-start to 1.134.6 fixed the issue also for me
I'm getting this error for swr which is a dependency of Clerk. Uncaught (in promise) SyntaxError: The requested module 'http://localhost:3000/node_modules/use-sync-external-store/shim/index.js?v=f1295605' doesn't provide an export named: 'useSyncExternalStore'
The index.js is for node_modules/swr/dist/index.mjs. Note that this is not imported by tanstack form but only clerk for me.
$ bun why swr
swr@2.3.4
└─ @clerk/shared@3.31.0 (requires 2.3.4)
├─ @clerk/backend@2.19.3 (requires ^3.31.0)
│ └─ @clerk/tanstack-react-start@0.26.7 (requires ^2.19.3)
If I understand #5726 correctly it only affects tanstacks internal libraries and not others.
I'm getting this same issue, and its coming from clerk. Did you find a fix?
I solved it now by using the same approach with optimizeDeps like the PR I linked. In my vite.config.ts I added these
Downgrading hasn't helped in my case, sadly. I've downgraded all the way down to 1.125.0 for Tanstack and 0.26.0 for Clerk. This appears to have happened when I introduced Clerk into Tanstack Start application.
However, after following a bunch of advice for both this and the other thread, I managed to get a bandaid fix working.
No other code changes needed on my end, and this seems to be the maximum changes needed, remove any of this (at least for me) and it seems to break sadly. Hope this helps someone!
You can update @clerk/tanstack-react-start to latest and remove the cookie-es replacement here. The cookie package is now bundled into the @clerk/backend package.
PR updating the starter to have this temporary fix - #6341
yeah @wobsoriano I'm still getting this and have for months. It's becoming more of a problem because I have to have my tanstack start versions pinned and can't update. Seemingly a Clerk issue...
Thanks for all the help.
Uncaught (in promise) SyntaxError: The requested module '/@fs/acme/node_modules/.bun/use-sync-external-store@1.6.0+83d5fd7b249dbeef/node_modules/use-sync-external-store/shim/index.js?v=5fc99785' does not provide an export named 'useSyncExternalStore' (at index.mjs?v=5fc99785:2:10)
yeah @wobsoriano I'm still getting this and have for months. It's becoming more of a problem because I have to have my tanstack start versions pinned and can't update. Seemingly a Clerk issue...
Thanks for all the help.
Uncaught (in promise) SyntaxError: The requested module '/@fs/acme/node_modules/.bun/use-sync-external-store@1.6.0+83d5fd7b249dbeef/node_modules/use-sync-external-store/shim/index.js?v=5fc99785' does not provide an export named 'useSyncExternalStore' (at index.mjs?v=5fc99785:2:10)
You can skip pinning versions and add the temporary fix! (ref)
yeah @wobsoriano I'm still getting this and have for months. It's becoming more of a problem because I have to have my tanstack start versions pinned and can't update. Seemingly a Clerk issue...
Thanks for all the help.
Uncaught (in promise) SyntaxError: The requested module '/@fs/acme/node_modules/.bun/use-sync-external-store@1.6.0+83d5fd7b249dbeef/node_modules/use-sync-external-store/shim/index.js?v=5fc99785' does not provide an export named 'useSyncExternalStore' (at index.mjs?v=5fc99785:2:10)
You can skip pinning versions and add the temporary fix! (ref)
the temporary fix being 0.27.14? If so, I still have this same error on that version too
We released Clerk Core 3, which includes a migration from swr to @tanstack/react-query. This means the error described here is now resolved for Clerk users.
I'm leaving the issue open, as it still applies to developers who are using libraries that depend on use-sync-external-store, like swr.
Activity
[-]cookie module leaking in client?[/-][+]Some server-side modules incorrectly bundled into the client?[/+]mackattack3k commentedon Nov 5, 2025
I'm getting this error for
swrwhich is a dependency of Clerk.Uncaught (in promise) SyntaxError: The requested module 'http://localhost:3000/node_modules/use-sync-external-store/shim/index.js?v=f1295605' doesn't provide an export named: 'useSyncExternalStore'The
index.jsis fornode_modules/swr/dist/index.mjs. Note that this is not imported by tanstack form but only clerk for me.$ bun why swr swr@2.3.4 └─ @clerk/shared@3.31.0 (requires 2.3.4) ├─ @clerk/backend@2.19.3 (requires ^3.31.0) │ └─ @clerk/tanstack-react-start@0.26.7 (requires ^2.19.3)If I understand #5726 correctly it only affects tanstacks internal libraries and not others.
JamalLyons commentedon Nov 7, 2025
I'm getting this same issue, and its coming from clerk. Did you find a fix?
mackattack3k commentedon Nov 7, 2025
I solved it now by using the same approach with optimizeDeps like the PR I linked.
In my vite.config.ts I added these
One for the clerk issue with
useSyncExternalStoreand one forcookiewhich had an issue withparseimport. Hope it works for you ✌️RadomirNowak commentedon Nov 7, 2025
to me the fix was to rollback
@tanstack/react-startto1.134.6. Any other combinations ofoptimizeDepsand what not unfortunately did not work at all.jjrise commentedon Nov 7, 2025
I can also confirm when using Clerk
z4p5a9 commentedon Nov 9, 2025
I have the same problem trying to use work os with start. Rolling back
@tanstack/react-startto1.134.6fixed the issue also for megbark commentedon Nov 10, 2025
Can also confirm that rolling back to
1.134.6solved the issueDanielSintimbrean commentedon Nov 10, 2025
With pnpm, I also had to add
public-hoist-pattern[]=cookieto the.npmrcfile.Tested in
1.134.18leonfs commentedon Dec 8, 2025
has this been finally solved upstream?
athammer commentedon Dec 9, 2025
Downgrading hasn't helped in my case, sadly. I've downgraded all the way down to
1.125.0for Tanstack and0.26.0for Clerk. This appears to have happened when I introduced Clerk into Tanstack Start application.However, after following a bunch of advice for both this and the other thread, I managed to get a bandaid fix working.
For my
vite.config.tsfile I added:For my
package.jsonfile I added:"cookie-es": "^2.0.0",My versions are: (I've tested a lot of different versions and doesn't appear to matter tmk)
No other code changes needed on my end, and this seems to be the maximum changes needed, remove any of this (at least for me) and it seems to break sadly. Hope this helps someone!
tedjames commentedon Dec 22, 2025
Still an issue and I can confirm that rolling back to
1.134.4seems to fix things for now.nikosdouvlis commentedon Dec 24, 2025
Can confirm that the issue still exists - the server modules are incorrectly bundled into the client-side using
@tanstack/react-start@1.142.5schiller-manuel commentedon Dec 24, 2025
@nikosdouvlis please provide a reproducer
arikark commentedon Dec 25, 2025
Add below to vite.config.ts:
resolve: { alias: [ { find: "use-sync-external-store/shim/index.js", replacement: "react", }, { find: "cookie", replacement: "cookie-es", }, ], },"@tanstack/react-start": "^1.132.0",
"@clerk/tanstack-react-start": "^0.27.8",
wobsoriano commentedon Jan 8, 2026
You can update
@clerk/tanstack-react-startto latest and remove thecookie-esreplacement here. Thecookiepackage is now bundled into the@clerk/backendpackage.PR updating the starter to have this temporary fix - #6341
jjrise commentedon Jan 9, 2026
yeah @wobsoriano I'm still getting this and have for months. It's becoming more of a problem because I have to have my tanstack start versions pinned and can't update. Seemingly a Clerk issue...
Thanks for all the help.
wobsoriano commentedon Jan 9, 2026
You can skip pinning versions and add the temporary fix! (ref)
jjrise commentedon Jan 10, 2026
the temporary fix being
0.27.14? If so, I still have this same error on that version toowobsoriano commentedon Jan 11, 2026
@jjrise the alias here. There's an old, similar issue here.
fwiw, we're removing SWR in favor of TanStack Query and that means this error will be gone as well.
fix(start-plugin-core): remove crawlFrameworkPkgs from optimizeDeps.e…
leonfs commentedon Jan 19, 2026
@wobsoriano - has the SWR dependency been finally removed then? Are we safe to update to latest version without any of the patches mentioned above?
wobsoriano commentedon Jan 19, 2026
@leonfs SWR will be removed in the next Clerk SDKs major release. That's probably next month. For now you still need to patch
use-sync-external-storefeat: migrate TanStack Start from Vinxi to Vite 7 + Nitro
wobsoriano commentedon Mar 4, 2026
Hi all 👋
We released Clerk Core 3, which includes a migration from
swrto@tanstack/react-query. This means the error described here is now resolved for Clerk users.I'm leaving the issue open, as it still applies to developers who are using libraries that depend on
use-sync-external-store, likeswr.