53 lines
1.4 KiB
JavaScript
53 lines
1.4 KiB
JavaScript
import { defineConfig } from 'vite';
|
|
import { VitePWA } from 'vite-plugin-pwa';
|
|
|
|
// GitHub Pages / sub-path friendly: set BASE_PATH env at build time if needed.
|
|
const base = process.env.BASE_PATH || '/';
|
|
|
|
export default defineConfig({
|
|
base,
|
|
build: {
|
|
target: 'es2020',
|
|
sourcemap: true,
|
|
},
|
|
plugins: [
|
|
VitePWA({
|
|
strategies: 'injectManifest',
|
|
srcDir: 'src',
|
|
filename: 'sw.js',
|
|
registerType: 'prompt',
|
|
injectManifest: {
|
|
globPatterns: ['**/*.{js,css,html,svg,png,ico,json,webmanifest}'],
|
|
// The bundled PokéAPI snapshot can be a few hundred KB.
|
|
maximumFileSizeToCacheInBytes: 5 * 1024 * 1024,
|
|
},
|
|
includeAssets: ['icon.svg', 'favicon.svg'],
|
|
manifest: {
|
|
name: 'Pokédex',
|
|
short_name: 'Pokédex',
|
|
description:
|
|
'A responsive, offline-capable Pokédex reference powered by PokéAPI.',
|
|
start_url: './',
|
|
scope: './',
|
|
display: 'standalone',
|
|
orientation: 'portrait',
|
|
background_color: '#0b0b0c',
|
|
theme_color: '#b3161a',
|
|
categories: ['games', 'reference', 'utilities'],
|
|
icons: [
|
|
{
|
|
src: 'icon.svg',
|
|
sizes: 'any',
|
|
type: 'image/svg+xml',
|
|
purpose: 'any maskable',
|
|
},
|
|
],
|
|
},
|
|
devOptions: {
|
|
enabled: false,
|
|
type: 'module',
|
|
},
|
|
}),
|
|
],
|
|
});
|