2025-04-01 14:20:42 -07:00
|
|
|
import react from '@vitejs/plugin-react'
|
2025-04-01 15:31:19 -07:00
|
|
|
import viteTsconfigPaths from 'vite-tsconfig-paths'
|
|
|
|
import eslint from '@nabla/vite-plugin-eslint'
|
|
|
|
import { defineConfig, configDefaults } from 'vitest/config'
|
2024-02-07 11:36:19 -05:00
|
|
|
import version from 'vite-plugin-package-version'
|
2025-03-18 20:25:51 -07:00
|
|
|
import topLevelAwait from 'vite-plugin-top-level-await'
|
2025-04-01 15:31:19 -07:00
|
|
|
// @ts-ignore: No types available
|
|
|
|
import { lezer } from '@lezer/generator/rollup'
|
2023-07-20 19:25:04 -04:00
|
|
|
|
2023-07-24 17:26:26 -04:00
|
|
|
const config = defineConfig({
|
2023-07-20 19:25:04 -04:00
|
|
|
server: {
|
|
|
|
open: true,
|
|
|
|
port: 3000,
|
2024-04-16 15:35:43 -04:00
|
|
|
watch: {
|
2024-06-29 18:10:07 -07:00
|
|
|
ignored: [
|
|
|
|
'**/target/**',
|
|
|
|
'**/dist/**',
|
|
|
|
'**/build/**',
|
|
|
|
'**/test-results/**',
|
|
|
|
'**/playwright-report/**',
|
|
|
|
],
|
2024-04-16 15:35:43 -04:00
|
|
|
},
|
2023-07-20 19:25:04 -04:00
|
|
|
},
|
2023-08-08 10:50:27 +10:00
|
|
|
test: {
|
|
|
|
globals: true,
|
2024-03-14 15:56:45 -04:00
|
|
|
pool: 'forks',
|
|
|
|
poolOptions: {
|
|
|
|
forks: {
|
|
|
|
maxForks: 2,
|
|
|
|
minForks: 1,
|
2024-04-19 14:24:40 -07:00
|
|
|
},
|
2024-03-14 15:56:45 -04:00
|
|
|
},
|
2024-04-19 14:24:40 -07:00
|
|
|
setupFiles: ['src/setupTests.ts', '@vitest/web-worker'],
|
2023-08-08 10:50:27 +10:00
|
|
|
environment: 'happy-dom',
|
|
|
|
coverage: {
|
2024-04-19 14:24:40 -07:00
|
|
|
provider: 'istanbul', // or 'v8'
|
2023-08-08 10:50:27 +10:00
|
|
|
},
|
2025-03-25 13:24:41 -04:00
|
|
|
exclude: [...configDefaults.exclude, '**/e2e/**/*.spec.*', 'rust'],
|
2024-02-11 12:59:00 +11:00
|
|
|
deps: {
|
2024-04-19 14:24:40 -07:00
|
|
|
optimizer: {
|
|
|
|
web: {
|
|
|
|
include: ['vitest-canvas-mock'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
clearMocks: true,
|
|
|
|
restoreMocks: true,
|
|
|
|
mockReset: true,
|
|
|
|
reporters: process.env.GITHUB_ACTIONS
|
|
|
|
? ['dot', 'github-actions']
|
2025-03-24 14:57:01 -05:00
|
|
|
: // Gotcha: 'hanging-process' is very noisey, turn off by default on localhost
|
|
|
|
// : ['verbose', 'hanging-process'],
|
|
|
|
['verbose'],
|
2024-04-19 14:24:40 -07:00
|
|
|
testTimeout: 1000,
|
|
|
|
hookTimeout: 1000,
|
|
|
|
teardownTimeout: 1000,
|
2023-08-08 10:50:27 +10:00
|
|
|
},
|
2023-07-20 19:25:04 -04:00
|
|
|
build: {
|
|
|
|
outDir: 'build',
|
|
|
|
},
|
2024-06-30 14:30:44 -07:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
'@kittycad/codemirror-lsp-client': '/packages/codemirror-lsp-client/src',
|
2025-01-04 13:57:24 -05:00
|
|
|
'@kittycad/codemirror-lang-kcl': '/packages/codemirror-lang-kcl/src',
|
2025-03-01 13:59:01 -08:00
|
|
|
'@rust': '/rust',
|
2024-06-30 14:30:44 -07:00
|
|
|
},
|
|
|
|
},
|
2025-03-18 20:25:51 -07:00
|
|
|
plugins: [
|
|
|
|
react(),
|
|
|
|
viteTsconfigPaths(),
|
|
|
|
eslint(),
|
|
|
|
version(),
|
|
|
|
lezer(),
|
|
|
|
topLevelAwait({
|
|
|
|
// The export name of top-level await promise for each chunk module
|
|
|
|
promiseExportName: '__tla',
|
|
|
|
// The function to generate import names of top-level await promise in each chunk module
|
|
|
|
promiseImportName: (i) => `__tla_${i}`,
|
|
|
|
}),
|
|
|
|
],
|
2024-04-16 21:36:19 -07:00
|
|
|
worker: {
|
2024-04-19 14:24:40 -07:00
|
|
|
plugins: () => [viteTsconfigPaths()],
|
|
|
|
},
|
2023-07-24 17:26:26 -04:00
|
|
|
})
|
2023-07-21 12:48:23 -04:00
|
|
|
|
2024-02-29 13:41:20 -08:00
|
|
|
export default config
|