$foliate is a Vite-only alias, deliberately absent from kit.alias and tsconfig paths: TypeScript cannot resolve it, so the ambient declaration in src/lib/reader/foliate.d.ts is the only candidate and svelte-check never walks the ~11k lines of untyped vendored JS. The generated tsconfig includes src/**/*.js and checkJs is on, so src/lib/vendor is excluded as well — `exclude` replaces rather than merges, hence the repeated service-worker entries. optimizeDeps.include for construct-style-sheets-polyfill: it sits behind a dynamic import in fixed-layout.js, so Vite would otherwise discover it mid-session and force a page reload on the first fixed-layout EPUB. Verified with a temporary import that the graph resolves: view.js and paginator.js are emitted as chunks, and the bundled pdf.js is our stub rather than upstream's bare `import '@pdfjs/pdf.min.mjs'`.
24 lines
922 B
TypeScript
24 lines
922 B
TypeScript
import tailwindcss from '@tailwindcss/vite';
|
|
import { sveltekit } from '@sveltejs/kit/vite';
|
|
import { defineConfig } from 'vite';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
export default defineConfig({
|
|
plugins: [tailwindcss(), sveltekit()],
|
|
resolve: {
|
|
alias: {
|
|
// Deliberately a Vite-only alias, and deliberately not in kit.alias or
|
|
// tsconfig paths. TypeScript cannot resolve `$foliate/*`, so the ambient
|
|
// declaration in src/lib/reader/foliate.d.ts is the only candidate and
|
|
// svelte-check never walks the ~11k lines of untyped vendored JS.
|
|
$foliate: fileURLToPath(new URL('./src/lib/vendor/foliate-js', import.meta.url))
|
|
}
|
|
},
|
|
optimizeDeps: {
|
|
// Behind a dynamic import in foliate's fixed-layout.js, so Vite would
|
|
// otherwise discover it mid-session and force a full page reload the first
|
|
// time someone opens a fixed-layout EPUB.
|
|
include: ['construct-style-sheets-polyfill']
|
|
}
|
|
});
|