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
Barrel files are bad for Vite dev server performance (and probably bad for code splitting too if we were doing more of it — and we intend to). We should get rid of them, starting with the biggest ones. It should be a noisy but very mechanical change. I think this also means getting rid of @oxide/ui and friends in favor of normal direct imports from, e.g., ~/libs/ui/... or whatever.
When you only import an individual API, e.g. import { slash } from './utils', all the files in that barrel file need to be fetched and transformed as they may contain the slash API and may also contain side-effects that run on initialization. This means you're loading more files than required on the initial page load, resulting in a slower page load.
If possible, you should avoid barrel files and import the individual APIs directly, e.g. import { slash } from './utils/slash.js'. You can read issue #8237 for more information.
We have numerous examples, some worse than others.
There are a couple more (app/hooks is the one that matters) but we're close enough and are seeing (I think) substantially faster HMR as a result of only having to reload the one changed file instead of nearly all of them. Initial page load doesn't seem faster.
Barrel files are bad for Vite dev server performance (and probably bad for code splitting too if we were doing more of it — and we intend to). We should get rid of them, starting with the biggest ones. It should be a noisy but very mechanical change. I think this also means getting rid of
@oxide/ui
and friends in favor of normal direct imports from, e.g.,~/libs/ui/...
or whatever.https://vitejs.dev/guide/performance.html#avoid-barrel-files
We have numerous examples, some worse than others.
console/app/pages/project/index.tsx
Lines 9 to 14 in 5d989a7
I think this means that from Vite's point of view, any file that imports any UI component depends on every UI component.
console/libs/ui/index.ts
Lines 15 to 55 in 5d989a7
The text was updated successfully, but these errors were encountered: