Skip to content

Conversation

@adel-haidar
Copy link

This PR should resolve the issue #1130. According to this thread, the issue has been resolved in the newest version of pdfjs-dist, a dependency of the ng2-pdf-viewer.

The following error is thrown when using the library with the old version of pdfjs-dist:
10:22:02 AM [vite] warning:
.../src/frontend/.angular/cache/18.2.2/vite/deps/ng2-pdf-viewer.js
11940| const worker = yield import(
11941| /webpackIgnore: true/
11942| this.workerSrc
| ^^^^^^^^^^^^^^
11943| );
11944| return worker.WorkerMessageHandler;
The above dynamic import cannot be analyzed by Vite.
See https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars\#limitations for supported dynamic import formats. If this is intended to be left as-is, you can use the /* @vite-ignore */ comment inside the import() call to suppress this warning.

The following error is thrown when using the library
with the old version of pdfjs-dist:
10:22:02 AM [vite] warning:
.../src/frontend/.angular/cache/18.2.2/vite/deps/ng2-pdf-viewer.js
11940|        const worker = yield import(
11941|          /*webpackIgnore: true*/
11942|          this.workerSrc
   |          ^^^^^^^^^^^^^^
11943|        );
11944|        return worker.WorkerMessageHandler;
The above dynamic import cannot be analyzed by Vite.
See https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars\#limitations for supported dynamic import formats. If this is intended to be left as-is, you can use the /* @vite-ignore */ comment inside the import() call to suppress this warning.
@JeevanMahesha
Copy link

@VadimDez can you please review this PR.

@adel-haidar
Copy link
Author

@VadimDez When can you review this PR?

@AndrewTran03
Copy link

@VadimDez Could you please review this PR whenever possible? I think it can greatly benefit those utilizing this package.

@alvarofilho
Copy link

@VadimDez Can you please review this PR? I can't stand this warn on the project anymore and not being able to fix it!

Copy link
Contributor

@shamoon shamoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nagging rarely works in the OSS world, it just pings all of the other people subscribed...

Anyway, this PR is not actually ready to be merged.

  1. You should not change the ng2-pdf-viewer version, that is not the job of a PR.
  2. You dont actually bump the package lock
  3. Finally, since you are bumping pdfjs-dist across a major version, did you actually take the time to check whether this breaks anything? Indeed, even a cursory check shows it most certainly does:
Screenshot 2025-04-30 at 3 05 09 PM

(expected):
Screenshot 2025-04-30 at 3 08 07 PM

@fua03
Copy link

fua03 commented May 22, 2025

Hi guys! any news? any progress?

@adel-haidar
Copy link
Author

@fua03 I am very busy right now, I will try to look at it at the weekend. @shamoon I am really not trying to nag or harass anybody 😄 I just wanted to get rid of these warnings and it was very late in the evening, so yes, I admit, I didn't check weather this breaks anything, my bad 😞. If anyone has the time to check it out, you are welcome to do so 😄.

@adel-haidar
Copy link
Author

adel-haidar commented May 25, 2025

@shamoon Alright, I reset the version to 10.4.0 and commited and pushed the package-lock.json. I also updated pdfjs again to the latest version 5.2.133. I am unable to reproduce the error you described. Whether I use the old or the new version of pdfjs it still looks the same:
Screenshot 2025-05-25 at 13 15 19

I don't know, maybe I am doing something wrong. but, Even in the example On StackBlitz it looks the same. It looks ok to me 😄

@saulin18
Copy link

HELP!!!

@adel-haidar
Copy link
Author

Thank you @Fabiencdp!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants