[英]Array.prototype.flat() creates an error when building Gatsby site
When building, I get the following error: 构建时,我收到以下错误:
WebpackError: TypeError: Object.entries(...).map(...).flat is not a function
I can gatsby deveop
the app just fine, and all works as expected in the browser. 我可以
gatsby deveop
应用程序就好了,所有工作都在浏览器中按预期工作。
Any ideas on how to remedy this? 关于如何解决这个问题的任何想法?
I'm not sure if this is ideal, but the only way I was able to fix this was by adding a polyfill and including it at the top of the offending file. 我不确定这是否理想,但我能够解决这个问题的唯一方法是添加一个polyfill并将其包含在有问题的文件的顶部。
> yarn add array-flat-polyfill
// src/pages/page-with-error.js
import 'array-flat-polyfill';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.