This feature is causing extreme lag during our development process, specifically around writing tests. I also posted on Stack Overflow. https://stackoverflow.com/questions/76104110/is-it-possible-to-configure-vite-so-source-code-is-bundled-in-development-inste
#Can vite be configured to bundle src code instead of requesting modules over network?
1 messages · Page 1 of 1 (latest)
Currently this isn't possible. If you aren't using Vite 4.3, please migrate to it as it should help quite a bit compared to 4.2
Still 2000 modules is going to require some time, especially if you use plugins to deal with tailwind for example
https://github.com/antfu/vite-plugin-inspect can help identify where the time is spent and maybe you can migrate to faster alternatives were available. Avoid sass for example, and go for PostCSS
Try to use extensions in your imports so resolution is faster. And split your code using dynamic imports where possible
About bundling parts of your code, how it works right now is that you would create packages for these parts. You can migrate to a monorepo (using pnpm or any other pm) if you aren't already using one. And then for some of these linked deps you can force their optimization. Check https://vitejs.dev/guide/dep-pre-bundling.html#monorepos-and-linked-dependencies
Thanks for the reply. Yeah, we'd like to break the monolith into micro-frontends / monorepo packages and use dynamic imports. It's going to be a big refactoring effort. We were hopeful Vite could help speed us up since the dev server and build times were so slow. To some degree it has, but when writing Cypress tests where every test does a fresh page load, it's very slow to develop.