farminf / pannellum-react

React Component for Pannellum (open source panorama viewer for the web)
MIT License
112 stars 81 forks source link

NextJS Support #127

Open mostafa-bs23 opened 10 months ago

mostafa-bs23 commented 10 months ago

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

glauber-bispo-coopers commented 7 months ago

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>
  )
}