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

ReferenceError: navigator is not defined on fresh install #2878

Open
justinblayney opened this issue Jan 16, 2021 · 3 comments
Open

ReferenceError: navigator is not defined on fresh install #2878

justinblayney opened this issue Jan 16, 2021 · 3 comments

Comments

@justinblayney
Copy link

Hello,
I am tryign to use this in my next.js headless CMS.
I have installed as per these instrcutions
https://revealjs.com/installation/#installing-from-npm

when i try to use it I get this error

Server Error

ReferenceError: navigator is not defined
This error happened while generating the page. Any console logs will be displayed in the terminal window.
Source

external%20%22reveal.js%22 (1:0) @ eval

1 | module.exports = require("reveal.js");

@grazzolini
Copy link

You have to use dynamic imports and disable SSR, since reveal.js is a browser side library.

@TogetherAsOneCHFP
Copy link

TogetherAsOneCHFP commented Feb 27, 2021 via email

@edilsonborges
Copy link

I had the same problem, and following @grazzolini tip, fixed my bug. Just tu give people that might need and example:

import dynamic from 'next/dynamic';

const ComponentDemo = dynamic(
  () => import('../ComponentDemo').then((module) => module.default),
  {
    ssr: false,
  }
);

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

No branches or pull requests

4 participants