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
// 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
Download from the command line
curl -L -o vite.config.ts https://files.samplefiles.com/config/vite-config/vite.config.tswget https://files.samplefiles.com/config/vite-config/vite.config.tshttps://files.samplefiles.com/config/vite-config/vite.config.tsprintf '%s %s\n' 4fca7468534c0feb08c283e9d6518e318f861ca446eb9b13eb69757b5f1f7ea9 vite.config.ts | shasum -a 256 -cOr check the download in your browser with the checksum calculator.