Skip to content

Commit

Permalink
Use vite-plugin-static-copy to copy cMaps and standard fonts in sampl…
Browse files Browse the repository at this point in the history
…e and test suites
  • Loading branch information
wojtekmaj committed Jul 21, 2023
1 parent 38f3d38 commit 31cc658
Show file tree
Hide file tree
Showing 15 changed files with 875 additions and 138 deletions.
5 changes: 2 additions & 3 deletions sample/vite3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
"type": "module",
"scripts": {
"build": "vite build",
"copy-cmaps": "node --loader ts-node/esm ./scripts/copy-cmaps.ts",
"copy-standard-fonts": "node --loader ts-node/esm ./scripts/copy-standard-fonts.ts",
"dev": "vite",
"preview": "vite preview"
},
Expand All @@ -24,6 +22,7 @@
"devDependencies": {
"@vitejs/plugin-react": "^2.2.0",
"typescript": "^5.0.0",
"vite": "^3.0.0"
"vite": "^3.0.0",
"vite-plugin-static-copy": "^0.17.0"
}
}
17 changes: 0 additions & 17 deletions sample/vite3/scripts/copy-cmaps.ts

This file was deleted.

20 changes: 0 additions & 20 deletions sample/vite3/scripts/copy-standard-fonts.ts

This file was deleted.

23 changes: 23 additions & 0 deletions sample/vite3/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import path from 'node:path';
import { createRequire } from 'node:module';

import { defineConfig } from 'vite';
import { viteStaticCopy } from 'vite-plugin-static-copy';

const require = createRequire(import.meta.url);
const cMapsDir = path.join(path.dirname(require.resolve('pdfjs-dist/package.json')), 'cmaps');
const standardFontsDir = path.join(
path.dirname(require.resolve('pdfjs-dist/package.json')),
'standard_fonts',
);

export default defineConfig({
plugins: [
viteStaticCopy({
targets: [
{ src: cMapsDir, dest: '' },
{ src: standardFontsDir, dest: '' },
],
}),
],
});
Loading

0 comments on commit 31cc658

Please sign in to comment.