Skip to content

nextjs 15 cant import lottiefiles/react-lottie-player in client components , ReferenceError: document is not defined #176

@bloodykheeng

Description

@bloodykheeng

importing the package in next js use client components results intor that this error
ReferenceError: document is not defined

import { Player, Controls } from '@lottiefiles/react-lottie-player';

please improve the package so that it runs in client only smoothly

without me needing to first do this

const { Player, Controls } = {
    Player: dynamic(
        () =>
            import("@lottiefiles/react-lottie-player").then((mod) => mod.Player),
        { ssr: false }
    ),
    Controls: dynamic(
        () =>
            import("@lottiefiles/react-lottie-player").then((mod) => mod.Controls),
        { ssr: false }
    ),
};

am using react 19
nextjs 15
"@lottiefiles/react-lottie-player": "^3.6.0",

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions