Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions web-app/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,87 +1,95 @@
import { defineConfig, loadEnv } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import path from 'path'
import { TanStackRouterVite } from '@tanstack/router-plugin/vite'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
import packageJson from './package.json'
const host = process.env.TAURI_DEV_HOST

Check warning on line 8 in web-app/vite.config.ts

View workflow job for this annotation

GitHub Actions / coverage-check

1-8 lines are not covered with tests

// https://vite.dev/config/
export default defineConfig(({ mode }) => {

Check warning on line 11 in web-app/vite.config.ts

View workflow job for this annotation

GitHub Actions / coverage-check

11 line is not covered with tests
// Load env file based on `mode` in the current working directory.
const env = loadEnv(mode, process.cwd(), '')

Check warning on line 13 in web-app/vite.config.ts

View workflow job for this annotation

GitHub Actions / coverage-check

13 line is not covered with tests

return {
plugins: [
TanStackRouterVite({
target: 'react',
autoCodeSplitting: true,
routeFileIgnorePattern: '.((test).ts)|test-page',
}),
react(),
tailwindcss(),
nodePolyfills({
include: ['path'],
}),
],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
optimizeDeps: {
exclude: ['@jan/extensions-web'],
},
build: {
rollupOptions: {
external: ['@jan/extensions-web'],
},
},
define: {
IS_TAURI: JSON.stringify(process.env.IS_TAURI),
IS_WEB_APP: JSON.stringify(false),
IS_MACOS: JSON.stringify(
process.env.TAURI_ENV_PLATFORM?.includes('darwin') ?? false
),
IS_WINDOWS: JSON.stringify(
process.env.TAURI_ENV_PLATFORM?.includes('windows') ?? false
),
IS_LINUX: JSON.stringify(
process.env.TAURI_ENV_PLATFORM?.includes('linux') ?? false
),
IS_IOS: JSON.stringify(
process.env.TAURI_ENV_PLATFORM?.includes('ios') ?? false
),
IS_ANDROID: JSON.stringify(
process.env.TAURI_ENV_PLATFORM?.includes('android') ?? false
),
PLATFORM: JSON.stringify(process.env.TAURI_ENV_PLATFORM),

Check warning on line 59 in web-app/vite.config.ts

View workflow job for this annotation

GitHub Actions / coverage-check

15-59 lines are not covered with tests

VERSION: JSON.stringify(packageJson.version),

Check warning on line 61 in web-app/vite.config.ts

View workflow job for this annotation

GitHub Actions / coverage-check

61 line is not covered with tests

POSTHOG_KEY: JSON.stringify(env.POSTHOG_KEY),
POSTHOG_HOST: JSON.stringify(env.POSTHOG_HOST),
MODEL_CATALOG_URL: JSON.stringify(
'https://raw.githubusercontent.com/menloresearch/model-catalog/main/model_catalog.json'
),
AUTO_UPDATER_DISABLED: JSON.stringify(
env.AUTO_UPDATER_DISABLED === 'true'
),
},

Check warning on line 71 in web-app/vite.config.ts

View workflow job for this annotation

GitHub Actions / coverage-check

63-71 lines are not covered with tests

// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
//
// 1. prevent vite from obscuring rust errors
clearScreen: false,

Check warning on line 76 in web-app/vite.config.ts

View workflow job for this annotation

GitHub Actions / coverage-check

76 line is not covered with tests
// 2. tauri expects a fixed port, fail if that port is not available
server: {
port: 1420,
strictPort: true,
host: host || false,
hmr: host
? {
protocol: 'ws',
host,
port: 1421,
}
: undefined,
watch: {

Check warning on line 89 in web-app/vite.config.ts

View workflow job for this annotation

GitHub Actions / coverage-check

78-89 lines are not covered with tests
// 3. tell vite to ignore watching `src-tauri`
ignored: ['**/src-tauri/**'],
},
},
}
})

Check warning on line 95 in web-app/vite.config.ts

View workflow job for this annotation

GitHub Actions / coverage-check

91-95 lines are not covered with tests
Loading