Overtime developers have gotten used to using bundlers, like WebPack, and know the struggle of waiting for long builds, especially as project become more complex. Vite works like a simple file server, but provides many enhancements over native ESM imports to support various features that are typically seen in bundler-based setups.In this episode, You walks us through Vite’s impressive capabilities, including the following:
- Vite provides an HMR API over native ESM. Frameworks with HMR capabilities can leverage the API to provide instant, precise updates without reloading the page or blowing away application state.
- JSON files and named imports can be directly imported- Debugging is made easy with files served over the network. Goodbye giant, unreadbale bundles
- Pre-bundling is performed with esbuild and makes Vite’s cold start time significantly faster than any JavaScript-based bundler
- Vite automatically rewrites code-split dynamic import calls so that nested imports fetch in parallel