Config Files · 1 file

Sample vite.config.ts File

vite.config.ts configures the Vite dev server and build. Our sample is realistic and valid for its tool, with fake hosts and secrets.

vite.config.ts · 645 B

Vite config

A vite.config.ts with a path alias, a dev-server proxy, environment-based base URL and manual chunk splitting. All hosts, keys and secrets are fake.

CC0 · free for any use · Verified by an independent tool · Report a problem

vite.config.ts — first linesTypeScript
// Sample vite.config.ts — samplefiles.com
import { defineConfig, loadEnv } from 'vite';
import { fileURLToPath, URL } from 'node:url';

export default defineConfig(({ mode }) => {
  const env = loadEnv(mode, process.cwd(), '');
  return {
    base: env.PUBLIC_BASE ?? '/',
    resolve: {
      alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) },
    },
    server: {
      port: 5173,
      proxy: { '/api': { target: 'http://localhost:3000', changeOrigin: true } },
    },
    build: {
      sourcemap: true,
      rollupOptions: {
        output: { manualChunks: { vendor: ['react', 'react-dom'] } },
      },
    },
  };
});

File details

Size
645 B (645 bytes)
MIME type
text/plain
SHA-256
4fca7468534c0feb08c283e9d6518e318f861ca446eb9b13eb69757b5f1f7ea9
MD5
3bf678ebbba313f012948cf7cc9b85d3

Download from the command line

curl -L -o vite.config.ts https://files.samplefiles.com/config/vite-config/vite.config.ts

Or check the download in your browser with the checksum calculator.