Create-react-app: Babel error when using greenlet on create-react-app 2.x

Created on 10 Nov 2018  路  6Comments  路  Source: facebook/create-react-app

Is this a bug report?

Yes

Did you try recovering your dependencies?

No, reproducible on a brand new project.

Which terms did you search for in User Guide?

N/A

Environment

  System:
    OS: macOS 10.14.1
    CPU: x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
  Binaries:
    Node: 10.11.0 - /usr/local/bin/node
    Yarn: 1.9.4 - /usr/local/bin/yarn
    npm: 6.4.1 - /usr/local/bin/npm
  Browsers:
    Chrome: 70.0.3538.77
    Firefox: 60.0.1
    Safari: 12.0.1
  npmPackages:
    react: ^16.6.1 => 16.6.1 
    react-dom: ^16.6.1 => 16.6.1 
    react-scripts: 2.1.1 => 2.1.1 
  npmGlobalPackages:
    create-react-app: Not Found

Steps to Reproduce

  1. Inside of a new create-react-app project, install greenlet (npm i greenlet)
  2. Wrap any function in greenlet HOF
  3. Include a spread operation inside of that function

Expected Behavior

In version 1.x of CRA, this was working without any issue. (I still have CRA 1.x deployed in production, I am working on upgrading)

Actual Behavior

An error occurs: ReferenceError: _Users_sjesso_workspace_greenlet_spread_issue_node_modules_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__ is not defined

screen shot 2018-11-10 at 2 24 34 pm 1

Reproducible Demo

I have attached a zip of a basic project that reproduces the problem to this ticket. It is an out-of-the-box CRA with greenlet installed and an example function written. If you change line 38 from return {...{time: Date.now()}}; to return {time: Date.now()}; then the code will run fine.

I removed the node_modules folder to make the zip a reasonable size, so don't forget to npm i before running!

greenlet-spread-issue.zip

Additional Context

We use greenlet in to make dealing with webworkers easier. In our app, we have a page that needs to load in excess of 50,000 records from an API call for reporting purposes. The data we receive back from the API needs to be massaged into data structures that are easy to work with in our charting library, and this work is done inside of a webworker to avoid blocking the main thread.

stale

All 6 comments

seem to work fine for me with npm and yarn.
EDIT: didn't look at console.log closely enough. It did show up.

capture

I am also getting this. I am running the same OS as OP if that makes a difference. Same stack trace as Tony, posted here just in case:

screen shot 2018-11-14 at 7 13 26 pm

Update: I got around this issue by moving my webworker scripts to /public and referencing them as opposed to using Greenlet.

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

razvan-soare picture razvan-soare  路  161Comments

godmar picture godmar  路  130Comments

jantimon picture jantimon  路  154Comments

benneq picture benneq  路  99Comments

andreypopp picture andreypopp  路  96Comments