Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Window is not defined when using nextjs #131

Closed
HypeLevels opened this issue Apr 6, 2021 · 5 comments
Closed

Window is not defined when using nextjs #131

HypeLevels opened this issue Apr 6, 2021 · 5 comments
Assignees

Comments

@HypeLevels
Copy link

Versions
BulmaJS: 0.12.1
Browser: Brave 0.12.1 and Google Chrome 87.0.4280.77 (iOS)
Operating system: Linux, KDE Neon

Describe the bug
When importing BulmaJS in a Next.js application the page doesn't render with the error message written in the title.

To Reproduce
Steps to reproduce the behavior:

  1. Add the following import to the top of the component import Bulma from '@vizuaalog/bulmajs';
  2. Run yarn dev or npm run dev or next dev
  3. Load in localhost:3000

Expected behavior
I expected BulmaJS to load without any issues.

Screenshots
image
image

Not sure if this is something related to Next.js as I haven't tried with another framework or even vanilla html.

@VizuaaLOG
Copy link
Owner

VizuaaLOG commented Apr 7, 2021

Hey 👋,

This has already been answered a few times, its due to you using a uncompiled version without a build system.

Please see #128

@HypeLevels
Copy link
Author

Hey! Sorry for bothering, had some time to test now and using the compiled version I get another issue (sadly :( ) since NextJS uses NodeJS to render the app the window object is not defined :(
image
image

@VizuaaLOG VizuaaLOG reopened this Apr 9, 2021
@VizuaaLOG VizuaaLOG changed the title SyntaxError: Cannot use import statement outside a module Window is not defined when using nextjs Apr 9, 2021
@VizuaaLOG
Copy link
Owner

Thanks for checking. Will look get a bug fix out that checks if window is defined before trying to register to it.

A workaround would be use the uncompiled versions and use something like webpack to build them as the individual plugins do not register themselves with window. This is a special case for the compiled versions.

@HypeLevels
Copy link
Author

Really appreciate the effort!

@VizuaaLOG
Copy link
Owner

Fixed in 0.12.2

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants