mirror of
https://github.com/jcreek/LivingDexTracker.git
synced 2026-09-16 10:32:10 +00:00
2766e5ea67
DEPLOY_TARGET now selects the adapter; Netlify stays the default and NODE_ADAPTER keeps working. Cloudflare compresses in transit, so the Worker build aliases $lib/server/compression to a pass-through that leaves the streaming body alone. CI builds and dry-run deploys this target. That is compilation and packaging coverage only, not a production compatibility gate: native sharp still blocks the share-preview route in the Worker runtime.
81 lines
2.4 KiB
TypeScript
81 lines
2.4 KiB
TypeScript
import { sveltekit } from '@sveltejs/kit/vite';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { defineConfig } from 'vite';
|
|
import { SvelteKitPWA } from '@vite-pwa/sveltekit';
|
|
// you don't need to do this if you're using generateSW strategy in your app
|
|
import { generateSW } from './pwa.mjs';
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
alias:
|
|
process.env.DEPLOY_TARGET === 'cloudflare'
|
|
? {
|
|
'$lib/server/compression': fileURLToPath(
|
|
new URL('./src/lib/server/compression.cloudflare.ts', import.meta.url)
|
|
)
|
|
}
|
|
: {}
|
|
},
|
|
plugins: [
|
|
sveltekit(),
|
|
SvelteKitPWA({
|
|
srcDir: './src',
|
|
mode: 'development',
|
|
// you don't need to do this if you're using generateSW strategy in your app
|
|
strategies: generateSW ? 'generateSW' : 'injectManifest',
|
|
// you don't need to do this if you're using generateSW strategy in your app
|
|
filename: generateSW ? undefined : 'prompt-sw.ts',
|
|
scope: '/',
|
|
base: '/',
|
|
selfDestroying: process.env.SELF_DESTROYING_SW === 'true',
|
|
pwaAssets: {
|
|
config: true
|
|
},
|
|
manifest: {
|
|
name: 'Living Dex Tracker',
|
|
short_name: 'Living Dex Tracker',
|
|
description:
|
|
'A tool to enable you to track your progress in completing the living Pokédex in Pokémon games.',
|
|
icons: [
|
|
{
|
|
src: '/android-chrome-192x192.png',
|
|
sizes: '192x192',
|
|
type: 'image/png'
|
|
},
|
|
{
|
|
src: '/android-chrome-512x512.png',
|
|
sizes: '512x512',
|
|
type: 'image/png',
|
|
purpose: 'any maskable'
|
|
}
|
|
],
|
|
start_url: '/',
|
|
scope: '/',
|
|
display: 'standalone',
|
|
theme_color: '#f00000',
|
|
background_color: '#f0f0f0'
|
|
},
|
|
injectManifest: {
|
|
globPatterns: ['client/**/*.{html,js,css,ico,png,svg,webp,woff,woff2,webmanifest}'],
|
|
globIgnores: ['**/sprites/**', '**/sprites-small/**', '**/sprites-grid/**']
|
|
},
|
|
workbox: {
|
|
globPatterns: ['client/**/*.{html,js,css,ico,png,svg,webp,woff,woff2,webmanifest}'],
|
|
globIgnores: ['**/sprites/**', '**/sprites-small/**', '**/sprites-grid/**'],
|
|
// Shared message/fetch handling keeps generateSW and injectManifest behavior equal.
|
|
importScripts: ['/offline-worker.js']
|
|
},
|
|
devOptions: {
|
|
enabled: false,
|
|
suppressWarnings: process.env.SUPPRESS_WARNING === 'true',
|
|
type: 'module',
|
|
navigateFallback: '/'
|
|
},
|
|
// if you have shared info in svelte config file put in a separate module and use it also here
|
|
kit: {
|
|
includeVersionFile: true
|
|
}
|
|
})
|
|
]
|
|
});
|