Babel error when using greenlet on create-react-app 2.x
See original GitHub issueIs 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
- Inside of a new create-react-app project, install greenlet (
npm i greenlet
) - Wrap any function in
greenlet
HOF - 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](https://user-images.githubusercontent.com/107810/48304742-eb8f7280-e4f4-11e8-9ad9-f4dd562e9b0a.png)
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!
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.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
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: