webex/react-widgets

Widgets not working: babelHelpers is not defined

saltenhub opened this issue · 4 comments

Bug report

I am not able to get any widget working with a current version of create-react-app (react-scripts v3.4.1) - the build finished fine, but when I try to access the page I am running into a reference error:

ReferenceError: babelHelpers is not defined

Error message

Steps to reproduce:

  • Create a react app with yarn create react-app (react-scripts current version - v3.4.1)
  • Add dependency for any widget, e.g. yarn add @webex/widget-space (v0.2.17)
  • Import widget for use via import SpaceWidget from @webex/widget-space
  • Add @formatjs/intl-pluralrules because of #1090 yarn add @formatjs/intl-pluralrules
  • yarn start to start the development server
  • Go to http://localhost:3000

Expected behavior:
The widget working as described in the documentation.

Same here - without importing the @webex/widget-space it works fine. We can't get the widget to run even in minimal react app.
ebabff6c-3f53-4afd-80d9-a0c891150436

I found a workaround...

install babel cli
npm i @babel/cli -D

generate the babelHelpers js
npx babel-external-helpers > babel-helpers.js

include in your project first. I am using webpack to did the following:
entry: [ './src/babel-helpers.js', './src/index.js' ],

Thanks for the support !

I have done the first two points, but now I am not sure where in the webpack I should insert the babel-helpers.js.

I found the webpack.config.js in the folder react-scripts/config/. I think this is the right file. I'm posting here a screenshot of my attempt to integrate your code. May I ask you for your support again.

Thanks in advance, best regards

image

This should be fixed with the latest PR that has been merged into master
#1110

This would be release 0.2.115