Next.js Discord

Discord Forum

Plotly Webgl works locally on production build but errors out on vercel

Unanswered
American Shorthair posted this in #help-forum
Open in Discord
Avatar
American ShorthairOP
I am in the process of integrating plotly. Locally with a production build as long as there are no route params the graph loads well and good. I am using a webgl version of plotly

WHAT I TRIED:

I have added plotly & react plotly in a component and added it in as a dynamic import with ssr disabled
const Chart = dynamic(
    () => {
        if (typeof window !== 'undefined') {
            return import('@components/Chart')
        }
        return Promise.resolve({ default: () => null })
    },
    {
        ssr: false
    }
)


I also added all the external libraries in the next-config.js like this

    experimental: {
        serverComponentsExternalPackages: ['plotly.js-gl2d-dist-min', 'react-plotly.js']
    }


I am fairly new to Next.js & Vercel and find it a mind blogging that something that is CSR is not working on vercel

0 Replies