Skip to content
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

Component does not work with Vaadin 23.3 #25

Closed
probert94 opened this issue Jan 2, 2023 · 3 comments · Fixed by #26
Closed

Component does not work with Vaadin 23.3 #25

probert94 opened this issue Jan 2, 2023 · 3 comments · Fixed by #26
Labels
enhancement New feature or request

Comments

@probert94
Copy link

probert94 commented Jan 2, 2023

I tried upgrading my project from Vaadin 23.2 to 23.3.
Unfortunately I get the following error:
SyntaxError: The requested module '/VAADIN/generated/jar-resources/print-js/dist/print.js' does not provide an export named 'default'

The issue can be reproduced with a Vaadin starter:

  1. Add vcf-pdf-viewer 2.5.2 as a dependency.
  2. Add the following code to MainView.java:
    public MainView() {
        PdfViewer pdfViewer = new PdfViewer();
        StreamResource resource = new StreamResource("example.pdf", () -> getClass().getResourceAsStream("/pdf/example.pdf"));
        pdfViewer.setSrc(resource);
        pdfViewer.openThumbnailsView();
        add(pdfViewer);
    }

It seems like there is a problem with pdf-js and vite but we are already using Vaadin 23.2 with vite so the issue is not related to vite only.

@TatuLund
Copy link

TatuLund commented Jan 2, 2023

PDF.js a such is not fully, compatible with vite: see mozilla/pdf.js#10317 (comment)

However workaround may exists to import the worked differently https://erindoyle.dev/using-pdfjs-with-vite/

Meanwhile, there is webpack fallback option in Vaadin 23, which allows to use the add-on in the current form.

@TatuLund TatuLund added the enhancement New feature or request label Jan 2, 2023
@probert94 probert94 changed the title Component does not work with Vaadin 23.3 (vite) Component does not work with Vaadin 23.3 Jan 2, 2023
@probert94
Copy link
Author

I forgot to mention, that we are already using Vaadin 23.2 with vite, so its not (only) a vite issue.
I think it might be related to a stricter typescript validation in vaadin 23.3, as we got a lot of typescript related errors when trying to update.

@javier-godoy
Copy link
Member

Fix has been released in version 2.5.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants