Skip to content

Commit

The site's pages load without throwing again. React and react-dom, and the UI primitives behind shadcn's components (Radix, floating-ui and their helpers), get chunks of their own: left inside the app's shared chunks, react-dom's initialiser landed in a chunk that imported the floating-ui code calling it, so that code ran first and threw 's is not a function', and tooltips, hover cards, menus and the spend pill in the top bar never came up.

syntaqxcommitted Parentbba76b3Browse files
1 file+15−00/1 viewed
+15−0
5858 output: {
5959 codeSplitting: {
6060 groups: [
61+ // React and react-dom are CommonJS, which the bundler wraps in
62+ // initialisers that a chunk calls while it loads. Left to
63+ // automatic splitting, react-dom's landed in an app chunk that
64+ // imports the chunk calling it, so that chunk ran first and
65+ // threw `s is not a function`: tooltips, cards, menus and the
66+ // spend pill never came up. In a chunk of their own, which
67+ // imports nothing of the app's, they are always ready first.
68+ { name: "react", test: /[\\/]node_modules[\\/](react|react-dom|scheduler|use-sync-external-store|react-is)[\\/]/, priority: 3 },
69+ // The UI primitives behind shadcn's components (Radix, and the
70+ // floating-ui that positions tooltips, cards and menus) set
71+ // themselves up while they load, calling each other. Inside the
72+ // app's chunks they could end up in two that import each other,
73+ // and whichever a page loaded first would call into the other
74+ // before it was ready. Together, apart from the app, they can't.
75+ { name: "ui", test: /[\\/]node_modules[\\/](radix-ui|@radix-ui[\\/][^\\/]+|@floating-ui[\\/][^\\/]+|aria-hidden|react-remove-scroll[^\\/]*|use-callback-ref|use-sidecar|react-style-singleton|get-nonce|tslib|detect-node-es)[\\/]/, priority: 3 },
6176 // Icons are shared by nearly every page, a few hundred bytes each:
6277 // one file for all of them, not a request per icon.
6378 { name: "icons", test: /[\\/]node_modules[\\/]lucide-react[\\/]/, priority: 2 },