#Can vite be configured to bundle src code instead of requesting modules over network?

1 messages · Page 1 of 1 (latest)

north shuttle
#

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

plush moon
#

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

#

Try to use extensions in your imports so resolution is faster. And split your code using dynamic imports where possible

north shuttle
#

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.

plush moon
#

You may wanna get in touch with Cypress folks (they have a discord I think) to see what tricks they have

#

On the Vite side, using dynamic imports is not only important for Vite dev, your users will also benefit, so it is worth the effort