Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

389
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda