template-desktop/astro.config.mjs

81 lines
1.6 KiB
JavaScript

import { defineConfig } from 'astro/config'
import tailwind from "@astrojs/tailwind"
import svelte from '@astrojs/svelte'
import routing from './hooks/routing'
// const faviconHook = {
// name: 'Favicon',
// hooks: {
// "astro:build:setup": async () => {
// await Manifest.create('./src/assets/favicon.png', {
// name: 'Template'
// })
// }
// }
// }
const isProd = !process.env.TAURI_DEBUG
// https://astro.build/config
export default defineConfig({
// some settings to the build output
build: {
// the asset path
assets: 'assets',
// inline the stylesheet if it is small enough
inlineStylesheets: 'auto'
},
// Compress the HTML output
compressHTML: isProd ? true : false,
// Customizable depending on goal
output: 'static',
// Add TailwindCSS
integrations: [svelte(), tailwind(), routing()],
// prefetch links
prefetch: {
defaultStrategy: 'hover'
},
// the site url
site: 'https://example.com',
// the Output server
server: {
host: true,
port: 3000,
watch: {
ignored: ['**/target/**']
}
},
// Remove the trailing slash by default
trailingSlash: 'never',
// Dev Server
vite: {
envPrefix: ['VITE_', 'TAURI_'],
server: {
watch: {
// Ignore some paths
ignored: [],
// support polling and WSL
usePolling: !!(process.env.USE_POLLING ?? process.env.WSL_DISTRO_NAME)
}
},
build: {
target: process.env.TAURI_ENV_PLATFORM == 'windows' ? 'chrome105' : 'safari13',
// don't minify for debug builds
minify: isProd ? 'esbuild' : false,
// produce sourcemaps for debug builds
sourcemap: !isProd,
}
},
})