- vite.config.ts: копирование pdf.worker + cMaps - LecturesPage.tsx: react-pdf viewer с навигацией по страницам - Скачивание через Telegram.WebApp.downloadFile (без изменений) - Убрал Google Docs Viewer — приватность
32 lines
893 B
TypeScript
32 lines
893 B
TypeScript
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import { viteStaticCopy } from 'vite-plugin-static-copy';
|
|
import path from 'node:path';
|
|
import { createRequire } from 'node:module';
|
|
|
|
const require = createRequire(import.meta.url);
|
|
const pdfjsDistPath = path.dirname(require.resolve('pdfjs-dist/package.json'));
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
viteStaticCopy({
|
|
targets: [
|
|
// pdf.worker.min.mjs — worker для pdf.js
|
|
{
|
|
src: path.join(pdfjsDistPath, 'build', 'pdf.worker.min.mjs'),
|
|
dest: 'pdf-worker',
|
|
},
|
|
// cMaps — для кириллицы и польских букв
|
|
{
|
|
src: path.join(pdfjsDistPath, 'cmaps', '*'),
|
|
dest: 'cmaps',
|
|
},
|
|
],
|
|
}),
|
|
],
|
|
build: {
|
|
chunkSizeWarningLimit: 1000,
|
|
},
|
|
}); |