-
Notifications
You must be signed in to change notification settings - Fork 12
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
Does not work in BGSW using Plasmo framework #2
Comments
Mmh, interesting. Which bundler does Plasmo use? Line 34 in f640d4d
Seems to me more like a Plasmo issue than unpdf. I have tested unpdf with esbuild, Rollup and more, which all correctly bundle Could you please provide a reproducible example? |
Bundler used is https://parceljs.org/ I believe... I know that I couldn't get plasmo to work with pdfjs either, so this very well could be a plasmo issue. Will drop an example in here when I get a moment, sorry about not including that the first round. My current workaround is to use unpdf on my proxy (vercel) server (normally used for other things) but this is really just to continue development, it would be really not-prime to handle everyone's PDF shenanigans when they could be doing it themselves on the client side. |
Hey there, sorry for taking so long! https://github.com/Fiattarone/unpdf-plasmo-example under core/test.ts is where I put it Or, even easier to reproduce with a one-liner: git clone git@github.com:Fiattarone/unpdf-plasmo-example.git --recurse-submodules &&
cd unpdf-plasmo-example &&
pnpm install &&
pnpm dev fails upon compiling If this is more of an issue with plasmo, I'll take it up with them--just let me know! |
Hi @Fiattarone, thanks for the reproduction. I tried to import the Even if we point to the PDF.js source file, the bundler fails to locate it: import { configureUnPDF, extractText } from "unpdf"
configureUnPDF({
pdfjs: () => import("unpdf/dist/pdfjs.mjs"),
}); Sorry, but at the moment, I don't have a fix for the Plasmo framework. Noted that Vite (using Rollup) and esbuild correctly resolves the import… |
Environment
Framework: Plasmo 0.84.0
Client side Chrome Browser Extension
Reproduction
Can be reproduced by creating a BGSW in the Plasmo framework and importing unpdf. Error message is:
🔴 ERROR | Build failed. To debug, run plasmo dev --verbose.
🔴 ERROR | Failed to resolve 'unpdf/pdfjs' from './node_modules/.pnpm/unpdf@0.10.0/node_modules/unpdf/dist/index.mjs'
Describe the bug
Bug is as aforementioned: unpdf seems to be looking for a pdfjs dependency that is inaccessible.
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: