farminf/pannellum-react

NextJS Support

Opened this issue · 1 comments

Can not support NextJS as SSR (Server Side Render). It returns an internal server error.

This is because this dep probrably need some frontend dependency, you must import it in a client side component, it can be used in next js in this way, here a example in next 13 that I was testing:

Image360.tsx

"use client";

import { Pannellum } from "pannellum-react";

import React from 'react'

const Image360 = () => {
  return (
    <div>
      <Pannellum
        width="100%"
        height="500px"
        image="/render-360-3dsmax-corona-1.jpg"
        pitch={10}
        yaw={180}
        hfov={110}
        autoLoad
        showZoomCtrl={false}
      />
    </div>
  )
}

export default Image360;

page.tsx

import Image360 from "@/components/Image360";

export default function Home() {
  return (
    <div className="">
      <Image360/>
    </div>
  )
}