Skip to content

Commit

Permalink
Uncaught TypeError: Designer is not a constructor #413 (#415)
Browse files Browse the repository at this point in the history
* Add umd to ui

* Update pdfjs-dist version

* Fix test
  • Loading branch information
hand-dot committed Jan 27, 2024
1 parent feb0c0c commit 807b920
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 302 deletions.
282 changes: 4 additions & 278 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 6 additions & 8 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@
"bugs": {
"url": "https://github.com/pdfme/pdfme/issues"
},
"type": "module",
"main": "dist/index.js",
"module": "dist/index.js",
"main": "dist/index.umd.js",
"module": "dist/index.es.js",
"types": "dist/types/index.d.ts",
"scripts": {
"dev": "npm-run-all --parallel devBuild:watch devBuildType:watch",
"devBuild:watch": "esbuild src/index.ts --bundle --outfile=dist/index.js --format=esm --watch",
"devBuild:watch": "esbuild src/index.ts --bundle --outfile=dist/index.es.js --format=esm --watch",
"devBuildType:watch": "tsc --emitDeclarationOnly --watch",
"build": "vite build && tsc --emitDeclarationOnly",
"clean": "rimraf dist",
Expand All @@ -44,7 +43,7 @@
"antd": "^5.9.4",
"form-render": "^2.2.16",
"hotkeys-js": "^3.8.7",
"pdfjs-dist": "^4.0.189",
"pdfjs-dist": "^3.11.174",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react-moveable": "^0.30.3",
Expand All @@ -67,7 +66,6 @@
"process": "^0.11.10",
"vite": "^5.0.0",
"vite-plugin-css-injected-by-js": "^3.3.0",
"vite-plugin-top-level-await": "^1.3.1",
"vite-tsconfig-paths": "^4.2.1"
},
"peerDependencies": {
Expand All @@ -87,8 +85,8 @@
"^form-render/es/": "form-render/lib/",
"^rc-picker/es/": "rc-picker/lib/",
"^lodash-es$": "lodash",
"^pdfjs-dist$": "<rootDir>/__mocks__/pdfjs-dist.js",
"^pdfjs-dist/build/pdf.worker.mjs$": "<rootDir>/__mocks__/pdfjs-dist.js"
"^pdfjs-dist/legacy/build/pdf.js$": "<rootDir>/__mocks__/pdfjs-dist.js",
"^pdfjs-dist/legacy/build/pdf.worker.entry.js$": "<rootDir>/__mocks__/pdfjs-dist.js"
},
"resolver": "ts-jest-resolver",
"moduleFileExtensions": [
Expand Down
7 changes: 4 additions & 3 deletions packages/ui/src/helper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { getDocument, GlobalWorkerOptions } from 'pdfjs-dist';
// TODO Update pdfjs-dist. (might be able to reduce the bundle size.)
// @ts-ignore
import * as pdfWorker from 'pdfjs-dist/build/pdf.worker.mjs';
GlobalWorkerOptions.workerSrc = pdfWorker;
import PDFJSWorker from 'pdfjs-dist/legacy/build/pdf.worker.entry.js';
import { getDocument, GlobalWorkerOptions } from 'pdfjs-dist/legacy/build/pdf.js';
GlobalWorkerOptions.workerSrc = PDFJSWorker;

import hotkeys from 'hotkeys-js';
import {
Expand Down

0 comments on commit 807b920

Please sign in to comment.