vite

  • Vite’s proxy for the API in development

    The dev server runs on a different port from the API, which is a cross-origin request, and proxying is simpler than configuring CORS for development only. changeOrigin rewrites…

  • import.meta.env is not process.env

    There is no process in a browser, so Vite exposes environment variables on import.meta.env and only the ones with a prefix. The prefix requirement is a security default…

  • A Vite build is Rollup, and the plugin API is Rollup’s

    Vite uses esbuild in development and Rollup for the production build, which means the plugin ecosystem to look in is Rollup’s. The two-engine arrangement is the source of…

  • Vite in development and webpack in production is a real answer

    A 38-second dev server start on a machine with nothing else to do. Native ESM changes the feedback loop, and running two build tools has a specific cost.

  • Vite’s dev server does not bundle, which is the whole idea

    A bundler in development builds the whole graph before serving anything, and a native ESM server builds nothing until the browser asks for a specific file. The start…