Webpack → Vite
medium10x faster dev server, simpler config. Most webpack plugins have Vite equivalents.
Add Vite and framework plugin.
npm install -D vite @vitejs/plugin-react && npm uninstall webpack webpack-cli webpack-dev-server
Minimal config. Most things work out of the box.
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({ plugins: [react()] })Move index.html to project root (not public/). Add <script type="module" src="/src/main.tsx">.
Vite requires file extensions for non-JS imports. Replace require() with import. Fix process.env → import.meta.env.
html-webpack-plugin → not needed. copy-webpack-plugin → vite-plugin-static-copy. define-plugin → define in vite.config.
package.json: dev → vite, build → vite build, preview → vite preview.
What this migration involves
Moving from Webpack to Vite is rated medium and takes about 4-8h on a typical project. The guide breaks it into 6 steps, 2 of which ship with runnable commands and 1 with a verification check.
Related migrations
FAQ
How long does migrating from Webpack to Vite take?
Around 4-8h for a typical project — 6 steps, difficulty rated medium, 2 of them with copy-paste commands.
Is moving from Webpack to Vite reversible?
No reverse guide is tracked yet, so treat this as a one-way move and keep a full export of your Webpack data before you start.
What does Vite cost compared to Webpack?
Vite: open-source from $0/mo, free plan available.