Skip to content

Commit

Permalink
Use Webpack 5 procedure for react-pdf (seems to work now)
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Jun 1, 2022
1 parent 7fb7793 commit 7b90b76
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
10 changes: 0 additions & 10 deletions scripts/copy-deps.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
const fs = require('fs-extra');
const path = require('path');

const pdfjsDistPath = path.dirname(require.resolve('pdfjs-dist/package.json'));
const pdfWorkerPath = path.join(pdfjsDistPath, 'build', 'pdf.worker.js');

const targetDir = 'public';
const targetPath = path.join(targetDir, 'pdf.worker.js');

// Ensure target directory exists
fs.mkdirSync(targetDir, { recursive: true });

// Copy file
fs.copyFileSync(pdfWorkerPath, targetPath);

// Copy js9
fs.copy(path.dirname(require.resolve('js9/package.json')), path.join(targetDir, 'js9'));
3 changes: 2 additions & 1 deletion src/renderer/views/snapshots.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ import {
} from '@mui/material';
import { blue, grey, purple } from '@mui/material/colors';
import React from 'react';
import { Document, Page, TextLayerItemInternal } from 'react-pdf';
import { TextLayerItemInternal } from 'react-pdf';
import { Document, Page } from 'react-pdf/dist/esm/entry.webpack5';
import { useKeywords, useWindowSize } from 'renderer/hooks';

export default function SnapshotsView() {
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8308,9 +8308,9 @@ __metadata:
linkType: hard

"electron-to-chromium@npm:^1.4.118":
version: 1.4.142
resolution: "electron-to-chromium@npm:1.4.142"
checksum: 53c6105ef81923a4dba0a53fdd1a010a492ad051eb527969e981ce78aee5ebdc729e7b16733e6cfb7b934ad23b84172d0677abaa5d9cd0ae71cd4cf986e4ab2e
version: 1.4.143
resolution: "electron-to-chromium@npm:1.4.143"
checksum: ce7f140b23ddee0127440c24357edfdd4683948cbf25d5f91ca9069a673b12c0da61cd05c3ae5b7f4b22e5a390a2f24e02d79d2011e6cc2fd5f05ba75870d920
languageName: node
linkType: hard

Expand Down

0 comments on commit 7b90b76

Please sign in to comment.