-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Rollup Browser Import #377
Comments
Unfortunately, I can't give you a good answer because I'm not enough of a rollup expert for this. The difficulty is to bundle the underlying PDFKit as it relies on some built in node modules that you have mentioned. The easiest way to get it working using rollup is to rely on the prebundeled version in If you really want to bundle it yourself, I can't give you any tips right now. But maybe someone else can? |
Thank you for your fast reply. After some more debuggin with your example project as helper did I found the culprint. Which is quite anoying to be honest. It seams my whole problem was not, that it did not import it correctly, but rather a warning. The warning now tries to log the line of the file where it occures. (Which made it quite anoying to get to the root of the warning, because it was printet so fast that it has overriden the first lines already.) But the file does basicly only have one line. (which is the whole file ^^) Warning: https://rollupjs.org/guide/en/#avoiding-eval When I have more time I will probably look for a solution for bundling it with the project. But as you have stated:
It won't matter that much, since I do not have a direct dependency to pdfkit. And when I use an older version: I will close the Issue. |
Yes, I noticed that warning too and I ran into the same problems reading it 😅. With v3.0.0 support for svg rendering was implemented. The warning comes from the library svg-engine, that is used to render svg in Node.js. I think the way eval is used is a valid use case as the input is sanitized. But if bundlers are complaining, I might reconsider that. Please let me know if you get to find a solution to bundle the project using rollup, I would like to document it in the readme. |
Hei @schoero it's me again. Sorry for the late follow up. I got the whole thing now working with rollup. rollup.config.mjs:
The think is you need a lot of plugins to handle the imports from the node packages which are only for backend. And in the tsconfig.json:
I still see an error on the import line for the Blobsteam. VS code or Svelte Plugin or I do not know which component is responsible for showing it thinks, it will use the node version:
But as soon as you build / serve it, it works. |
Hi Guys
First of all thank you very much for your effort. I think you are doing a great deed to us swiss devs.
Now to my problem:
When i try to use the newest version: 3.2.0 with rollup and I try to import it like this:
import SwissQrBill from "swissqrbill/lib/browser/bundle/index.js"
The system starts to do "something":
I am quite new to the whole webtech and currently hitting a wall with this issue.
When i try to use the second approach with the ES modules, it will resolve it just fine.
(At least when I import it like this:
import { PDF, BlobStream } from "swissqrbill/lib/browser/esm/browser/pdf.js";
)But then I have to solve the missing requirments:
That brings my to my two questions:
Some background infos:
The text was updated successfully, but these errors were encountered: