Open Ruthvik94 opened 7 months ago
Start a new pull request in StackBlitz Codeflow.
@Ruthvik94 Hi! Did you managed to figure it out?
I'm facing the same problem and managed to find that vite should support incremental builds but nothing on re-builds. Same with Rollup.
@Ruthvik94 Hi! Did you managed to figure it out?
I'm facing the same problem and managed to find that vite should support incremental builds but nothing on re-builds. Same with Rollup.
Nope, haven't figured out yet whether it's some config I'm missing that's causing re-builds every time. There's no clarity in docs as well. Hopefully, someone from Vite dev team will look into this.
also having these issues after migrating a large project from webpack to vite
@pyrbin @Ruthvik94 @AdamcOkay Hey folks!
We were also wondering about this and found a rollup plugin that did it, but it didn't work quite right with Vite. So we made a true incremental plugin (& wrapper) for Vite and it's been working beautifully for us! It has some pretty specific requirements for project structure but it was 100% worth it for us.
Some stats for reference:
![]()
![]()
For Vite folks reading this: When rolldown comes around, if we can have an option to build in "transpile only" mode, that would allow us to rebuild only the modified file without needing to also build the modules that it imports and would speed this up even more.
@Samydookie thanks for your work! It seems doing what you told, but in our case we are working on a Vite library using next.js and React 18 (as peer deps).
We are using rollupOptions.input
option to strip "lib" folder (eg. lib/components/Foo.tsx
-> will be compiled in dist/components/Foo.js
).
The first time we start incremental build all works fine. When we edit Foo.tsx
the new compiled file will be placed in dist/lib/components/Foo.js
. Is that supported by your library?
@Samydookie thanks for your work! It seems doing what you told, but in our case we are working on a Vite library using next.js and React 18 (as peer deps). We are using
rollupOptions.input
option to strip "lib" folder (eg.lib/components/Foo.tsx
-> will be compiled indist/components/Foo.js
). The first time we start incremental build all works fine. When we editFoo.tsx
the new compiled file will be placed indist/lib/components/Foo.js
. Is that supported by your library?
@Luk-z Oh yep we will need to follow the original entries object on rebuilds, which we currently don't do. I will add support for that very soon, you can add an issue on the GitHub project if you'd like and I'll close it when the version with the fix gets published
Whereas in Vite, build happens successfully and watches for changes. On change, it's a full rebuild taking more time than initial first build rather than doing incremental build.
Time it takes to build is around ~10s. Modify a file and check the build time, it's around ~4s.
These two descriptions don't match. Is the issue that subsequent builds aren't as fast as expected? I ran the repro locally, and I can see that subsequent builds are faster than the initial build (1.7s vs 7.8s).
I'm not really sure if there's anything actionable here. We're using rollup.watch
in watch mode, and Rollup should be caching things between builds.
Describe the bug
Issue is, Webpack v5 does a build, emits files and watches for changes. On any change, the rebuild happens almost instantaneously. Whereas in Vite, build happens successfully and watches for changes. On change, it's a full rebuild taking more time than initial first build rather than doing incremental build.
Closed the existing issue https://github.com/vitejs/vite/issues/16048 and created a new one for the same bug
Reproduction
https://stackblitz.com/edit/vitejs-vite-1ytjiw
Steps to reproduce
Intially run command
Time it takes to build is around ~10s. Modify a file and check the build time, it's around ~4s.
Stop the server and now run
Intial build roughly takes the same amount of time. Modify a file and check the build time, it's less than ~1s around 600ms.
System Info
Used Package Manager
npm
Logs
No response
Validations