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

window is not defined on SSR with Nuxt UI <UButton> #39

Open
MickL opened this issue May 1, 2024 · 0 comments
Open

window is not defined on SSR with Nuxt UI <UButton> #39

MickL opened this issue May 1, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@MickL
Copy link

MickL commented May 1, 2024

Environment

- Operating System: Darwin
- Node Version:     v21.6.1
- Nuxt Version:     3.11.2
- CLI Version:      3.11.1
- Nitro Version:    2.9.6
- Package Manager:  bun@1.1.6
- Builder:          -
- User Config:      devtools, modules, routeRules, i18n
- Runtime Modules:  @nuxt/ui@^2.15.2, @nuxt/fonts@^0.6.1, @nuxtjs/i18n@8.3.0, @sidebase/nuxt-pdf@^1.0.0-alpha.0
- Build Modules:    -

Reproduction

No response

Describe the bug

This works:

<button @click="exportToPDF('filename.pdf', pdfContent)">Create PDF</button>

This throws an error:

<UButton @click="exportToPDF('filename.pdf', pdfContent)">Create PDF</UButton>

On SSR it throws window is not defined from node_modules/jspdf/dist/jspdf.min.js:171:8032. When opening another page and then navigating to the page that contains the above code it works, e.g.:

  • /pdf -> error
  • /another-page -> /pdf -> works

Additional context

No response

Logs

No response

Btw. I wonder if this project is still maintained? According to #11 custom fonts dont work and pdf size is 8mb instead of 400kb.

@MickL MickL added the bug Something isn't working label May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant