【发布时间】:2021-12-02 02:35:33
【问题描述】:
当我尝试使用 yarn build 命令构建用于生产的 Next.js 应用程序时出现以下错误。但它在开发服务器中运行良好(使用yarn dev 命令时)。我正在使用 react-plotly.js 库在此反应应用程序中生成绘图图。
react-plotly 库的使用:
import Plot from 'react-plotly.js';
return(
<>
<Plot data={[data]} layout={layout} />
</>
)
这是错误:
> Build error occurred
ReferenceError: self is not defined
我已经研究了 plotly.js git 存储库和谷歌类似的问题,但似乎没有结果。知道 Next.js 纱线构建失败的原因吗?
【问题讨论】:
标签: javascript reactjs next.js build-error plotly.js