Skip to content

Commit

Permalink
Simplify documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Jul 3, 2024
1 parent ff82a89 commit e737025
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/react-pdf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ import fs from 'node:fs';
const pdfjsDistPath = path.dirname(require.resolve('pdfjs-dist/package.json'));
const pdfWorkerPath = path.join(pdfjsDistPath, 'build', 'pdf.worker.mjs');

fs.copyFileSync(pdfWorkerPath, './dist/pdf.worker.mjs');
fs.cpSync(pdfWorkerPath, './dist/pdf.worker.mjs', { recursive: true });
```

#### Use external CDN
Expand Down Expand Up @@ -267,9 +267,9 @@ Add [`vite-plugin-static-copy`](https://www.npmjs.com/package/vite-plugin-static
+import { viteStaticCopy } from 'vite-plugin-static-copy';

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

export default defineConfig({
plugins: [
Expand All @@ -293,7 +293,8 @@ Add [`copy-webpack-plugin`](https://www.npmjs.com/package/copy-webpack-plugin) b
+import path from 'node:path';
+import CopyWebpackPlugin from 'copy-webpack-plugin';

+const cMapsDir = path.join(path.dirname(require.resolve('pdfjs-dist/package.json')), 'cmaps');
+const pdfjsDistPath = path.dirname(require.resolve('pdfjs-dist/package.json'));
+const cMapsDir = path.join(pdfjsDistPath, 'cmaps');

module.exports = {
plugins: [
Expand All @@ -319,7 +320,8 @@ For example, you could use a custom script like:
import path from 'node:path';
import fs from 'node:fs';

const cMapsDir = path.join(path.dirname(require.resolve('pdfjs-dist/package.json')), 'cmaps');
const pdfjsDistPath = path.dirname(require.resolve('pdfjs-dist/package.json'));
const cMapsDir = path.join(pdfjsDistPath, 'cmaps');

fs.cpSync(cMapsDir, 'dist/cmaps/', { recursive: true });
```
Expand Down Expand Up @@ -434,10 +436,8 @@ For example, you could use a custom script like:
import path from 'node:path';
import fs from 'node:fs';

const standardFontsDir = path.join(
path.dirname(require.resolve('pdfjs-dist/package.json')),
'standard_fonts',
);
const pdfjsDistPath = path.dirname(require.resolve('pdfjs-dist/package.json'));
const standardFontsDir = path.join(pdfjsDistPath, 'standard_fonts');

fs.cpSync(standardFontsDir, 'dist/standard_fonts/', { recursive: true });
```
Expand Down

0 comments on commit e737025

Please sign in to comment.