Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

388
Views
Next.js yarn build failed due to plotly.js (Build error occurred ReferenceError: self is not defined)

I am getting the following error when I try to build the Next.js app for production using yarn build command. But it is working fine in the development server (when using yarn dev command). I am using react-plotly.js library for generating plot graphs in this react app.

Use of react-plotly lib:

import Plot from 'react-plotly.js';

return(
  <>
   <Plot data={[data]} layout={layout} />
  </>
)

Here is the error:

> Build error occurred
ReferenceError: self is not defined

enter image description here

I have researched the issues on plotly.js git repository and google similar problem but seems with no result. Any ideas why Next.js yarn build failed?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Next Js uses server side rendering and still simulates ssr when developing locally, due to this a number of libs reliant on native objects (commonly the window object) wont work as expected.

https://github.com/plotly/react-plotly.js/issues/40

It seems plotly does not work with ssr but there is another component that should https://github.com/aulneau/next.js-with-react-plotly.js

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!