Skip to content

NextJS Dynamic Imports With No SSR - ReferenceError: window is not defined #57

@danwetherald

Description

@danwetherald

We are in the need of a way to somehow get around a bunch of issues with SSR pixels.

We have a pixels component that uses context to get pixel information (pixel ids, tracking ids, etc). This component then can dynamically initialize the pixels from an array of different services (ie. facebook, snap, tikok, pinterest, etc).

The problem we are stuck with now is that we can't seem to figure out a way to get around the issue of the window being undefined when rendering this pixels component using NextJS.

Most resources point in this direction, but not sure how this will be possible with rescript?
https://nextjs.org/docs/advanced-features/dynamic-import#with-no-ssr

ReferenceError: window is not defined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions