Closed mohsn-mirzaei closed 3 months ago
This pull request fixes a build error by implementing a conditional dynamic import for Lottie.
require
NODE_ENV
next/dynamic
// Previous import import Lottie from "react-lottie"; // New imports import dynamic from "next/dynamic"; let Lottie; if (process.env.NODE_ENV === "development") { Lottie = require("react-lottie").default; } else { Lottie = dynamic(() => import("react-lottie"), { ssr: false }); }
Summary
This pull request fixes a build error by implementing a conditional dynamic import for Lottie.
Details
require
for importing Lottie whenNODE_ENV
is set to "development".next/dynamic
for importing Lottie with SSR disabled.Changes