-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
90 lines (89 loc) · 3.25 KB
/
vite.config.ts
File metadata and controls
90 lines (89 loc) · 3.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import { VitePWA } from 'vite-plugin-pwa'
import { resolve } from 'path'
// https://vite.dev/config/
export default defineConfig({
// Served at the root of the paceread.techscript.ca subdomain
base: '/',
plugins: [
react(),
VitePWA({
registerType: 'autoUpdate',
includeAssets: ['favicon.ico', 'apple-touch-icon.png', 'icons/*.png'],
manifest: {
name: 'PaceRead — Read Faster',
short_name: 'PaceRead',
description: 'PaceRead: RSVP speed reader. Read Faster. Understand Better. PDF, EPUB, DOCX, TXT, MD, HTML, RTF, SRT at 60–1500 WPM. Intelligent chunking, offline-first. Free, no ads, no tracking.',
theme_color: '#060606',
background_color: '#060606',
display: 'standalone',
orientation: 'portrait-primary',
scope: '/',
start_url: '/',
icons: [
{
src: 'icons/icon-192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: 'icons/icon-512.png',
sizes: '512x512',
type: 'image/png',
},
{
src: 'icons/icon-512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable',
},
],
file_handlers: [
{
action: '/open',
accept: {
'application/pdf': ['.pdf'],
'application/epub+zip': ['.epub'],
'application/vnd.openxmlformats-officedocument.wordprocessingml.document': ['.docx'],
'text/plain': ['.txt', '.srt'],
'text/markdown': ['.md'],
'text/html': ['.html', '.htm'],
'application/rtf': ['.rtf'],
},
},
],
},
workbox: {
// Cache the app shell
globPatterns: ['**/*.{js,css,html,svg,png,ico}'],
// Don't cache the heavy PDF worker (it changes between builds)
globIgnores: ['**/pdf.worker*'],
},
}),
],
// localforage@1.10.0 ships dist/localforage.js in its package.json "main"
// but this version's dist only contains localforage.min.js, causing Rollup
// to fail. Pin to the .min.js until localforage publishes a fixed release.
// If you upgrade localforage, verify the alias is still needed.
resolve: {
alias: {
localforage: resolve(
__dirname,
'node_modules/localforage/dist/localforage.min.js',
),
},
},
optimizeDeps: {
// Pre-bundle pdfjs-dist to avoid ESM resolution issues
// localforage is a dep of vite-plugin-pwa/workbox – needs explicit bundling
include: ['pdfjs-dist', 'localforage'],
},
worker: {
format: 'es',
},
test: {
environment: 'happy-dom',
globals: true,
},
})