Response viewer for PDF (#48)

This PR adds a response viewer for PDF files using `react-pdf`
This commit is contained in:
Gregory Schier
2024-06-10 08:57:08 -07:00
committed by GitHub
parent 456d3aaf52
commit 7cd8ac3b21
9 changed files with 750 additions and 29 deletions

View File

@@ -1,14 +1,35 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { internalIpV4 } from 'internal-ip';
import { createRequire } from 'node:module';
import path from 'node:path';
import { defineConfig, normalizePath } from 'vite';
import { viteStaticCopy } from 'vite-plugin-static-copy';
import svgr from 'vite-plugin-svgr';
import topLevelAwait from 'vite-plugin-top-level-await';
const require = createRequire(import.meta.url);
const cMapsDir = normalizePath(
path.join(path.dirname(require.resolve('pdfjs-dist/package.json')), 'cmaps'),
);
const standardFontsDir = normalizePath(
path.join(path.dirname(require.resolve('pdfjs-dist/package.json')), 'standard_fonts'),
);
const mobile = !!/android|ios/.exec(process.env.TAURI_ENV_PLATFORM ?? '');
// https://vitejs.dev/config/
export default defineConfig(async () => ({
plugins: [svgr(), react(), topLevelAwait()],
plugins: [
svgr(),
react(),
topLevelAwait(),
viteStaticCopy({
targets: [
{ src: cMapsDir, dest: '' },
{ src: standardFontsDir, dest: '' },
],
}),
],
clearScreen: false,
server: {
port: 1420,