elastic / next-eui-starter

Start building Kibana protoypes quickly with the Next.js EUI Starter
https://elastic.github.io/next-eui-starter/
Apache License 2.0
93 stars 30 forks source link

regeneratorRuntime is not defined #70

Closed devolt5 closed 2 years ago

devolt5 commented 2 years ago

It seems, that by adding EUI Components, other Objects are not defined.

E.g. if you add a <EuiDataGrid /> anywhere, you'll get:

error - node_modules/@elastic/eui/es/components/datagrid/utils/scrolling.js (74:0) @ eval
ReferenceError: regeneratorRuntime is not defined

I'm sure there any much more EUI Components which different missing Objects. What's the workflow for dealing with this issue?

chandlerprall commented 2 years ago

While EUI ships transpiled code, it intentionally does not include polyfills. This is so the component library does not dictate to consuming applications what polyfill to use, or potentially bloat the final bundle by including multiple versions of a polyfill.

However, we should address this in the starter project!

In other projects, polyfills can be added with:

import "core-js/stable";
import "regenerator-runtime/runtime";

as documented in https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md#babelpolyfill, and for reference we do this in Kibana - https://github.com/elastic/kibana/blob/main/packages/kbn-ui-shared-deps-src/src/polyfills.js#L9-L10