-
-
Notifications
You must be signed in to change notification settings - Fork 67
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
need help: Promise.withResolvers is not a function #127
Comments
After checking this I found this problem on two points: The first one is from The second one is from the vue-pdf/src/components/composable.ts Line 2 in de24ae4
Using the legacy worker fix the second point but It's still required to add the polyfill for the first point. import PDFWorker from 'pdfjs-dist/legacy/build/pdf.worker.min?url' |
This should works, It's important configure the legacy worker before using <script setup lang="ts">
+ import * as PDFJS from 'pdfjs-dist';
+ import LegacyWorker from 'pdfjs-dist/legacy/build/pdf.worker.min?url';
import { VuePDF, usePDF } from '@tato30/vue-pdf';
+ PDFJS.GlobalWorkerOptions.workerSrc = LegacyWorker
const { pdf } = usePDF('https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/web/compressed.tracemonkey-pldi-09.pdf')
</script>
<template>
<div>
<VuePDF :pdf="pdf" />
</div>
</template> |
Hi TaTo! |
I am sorry to border you.
... |
There are PR for this? |
@ZumelzuR Nope, this issue can be fixed using #127 (comment) It is not necessary to do something on source code. |
I saw that there are some code in master (that is doing this PDFJS.GlobalWorkerOptions.workerSrc = LegacyWorker) but is there is not a compiled version of this. Would be great have this master changes on a compiled version :) |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Hello, this issue is not a bug but I need some help.
I‘m using version 1.10.0 of this repository, and in older versions of Chrome (earlier than 105), Promise.withResolvers is not supported, causing an error when I preview PDFs: Promise.withResolvers is not a function.
I tried using Babel to support it or ask ChatGPT, but it didn't work. Can anyone help me?
I have tried this:
yarn add @babel/core @babel/preset-env @vitejs/plugin-vue vite-plugin-babel -D
yarn add promise-polyfill
vite.config.js:
main.js:
The text was updated successfully, but these errors were encountered: