Skip to content

Instantly share code, notes, and snippets.

@epreston
Last active April 27, 2023 18:12
Show Gist options
  • Save epreston/6edeed20bbf57e59d8492eba673b3478 to your computer and use it in GitHub Desktop.
Save epreston/6edeed20bbf57e59d8492eba673b3478 to your computer and use it in GitHub Desktop.
vite.config.js - example combo vite / vitest config, enforcing modern build target, test setup
// vite.config.js
// import types for vitest config autocomplete
/// <reference types="vitest" />
import { defineConfig } from 'vite';
export default defineConfig({
// assetsInclude: ['**/*.gltf', '**/*.glb', '**/*.m4a'], // additional asset types
// define: {
// // ensure inline tests are removed in production builds
// 'import.meta.vitest': 'undefined',
// },
// server: {
// open: '/index.html',
// },
// plugins: [vue(), splitVendorChunkPlugin()],
build: {
target: ['es2022', 'edge111', 'firefox111', 'chrome111', 'safari16.3', 'ios16.3'],
},
test: {
// disable threads on GH actions to speed it up
threads: !process.env.GITHUB_ACTIONS,
setupFiles: ['./test/setup.js'],
// includeSource: ['src/**/*.{js,ts}'], // enable inline tests
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment