Re:Esbuild – An extremely fast JavaScript bundler
by Rapzid on Thursday October 14, 2021 @02:36PM
(#28868144)
There is a short paragraph adressing this on the "Why Vite" page: https://vitejs.dev/guide/why.html#why-not-bundle-with-esbuil...
I'm also a huge fan of HMR, and esbuild in the past has been anti-HMR.
Re:Esbuild – An extremely fast JavaScript bundler
by maga on Thursday October 14, 2021 @07:50AM
(#28863045)
I guess it depends on your project and workflow preferences. Personally, I'm not a big fan of HMR and the bundling times are negligible even without "pre-bundling" npm dependencies (as Vite puts), so I see little reason for Vite.
Re:Esbuild – An extremely fast JavaScript bundler
by aidos on Thursday October 14, 2021 @09:05AM
(#28863714)
We switched over to Vite some time back and it's been pretty life changing. We're using react and tailwind too, so the HMR works really well for us.
The config is beyond minimal. If you're using webpack you may want to look away now :-)
import { resolve } from 'path'
import { defineConfig } from 'vite'
import reactRefresh from '@vitejs/plugin-react-refresh'
export default defineConfig({
plugins: [reactRefresh()],
build: {
rollupOptions: {
input: {
index: resolve(__dirname, 'index.html'),
}
},
sourcemap: true
},
esbuild: {
jsxInject: `import * as React from "react"`
},
resolve: {
alias: [
{ find: '@', replacement: '/src' },
]
},
})
I guess Vite provides a nice development experience but is built on esbuild.