fix(tauri): update tauri to work with vite

This commit is contained in:
Alice Carroll
2024-11-09 02:04:52 +03:00
parent fc879b888c
commit e1aa54e358
4 changed files with 38 additions and 5 deletions

4
web/.gitignore vendored
View File

@@ -21,4 +21,6 @@ yarn.lock
/blob-report/
/playwright/.cache/
.ronin
.ronin
app.config.timestamp_*.js

View File

@@ -1,7 +1,29 @@
import { defineConfig } from "@tanstack/start/config"
import tsConfigPaths from "vite-tsconfig-paths"
export default defineConfig({
const is_tauri = process.env.TAURI_ENV_TARGET_TRIPLE !== undefined;
let config = is_tauri ? defineConfig({
vite: {
envPrefix: ['VITE_', 'TAURI_ENV_*'],
build: {
target:
process.env.TAURI_ENV_PLATFORM == 'windows'
? 'chrome105'
: 'safari13',
minify: !process.env.TAURI_ENV_DEBUG ? 'esbuild' : false,
sourcemap: !!process.env.TAURI_ENV_DEBUG,
},
plugins: [
tsConfigPaths({
projects: ["./tsconfig.json"],
}),
],
},
server: {
preset: "static"
}
}) : defineConfig({
vite: {
plugins: [
tsConfigPaths({
@@ -10,3 +32,5 @@ export default defineConfig({
],
},
})
export default config;