If you are reporting a bug, please fill in below. Otherwise feel free to remove this template entirely.
Yes.
When a script with both a js class and a generator are defined, compilation breaks.
Compilation of script.
Browser console logs error message "...Uncaught ReferenceError: _regeneratorRuntime is not defined"
npm ls react-scripts:
[email protected] /Users/angelbeltran/dev/test/my-app
└── [email protected]
node -v:
v7.0.0
npm -v:
4.5.0
https://github.com/angelbeltran/my-test-app
I added a simple class and generator to src/index.js.
Clone and enter the project, and run
npm start
When the browser opens, you'll get the error message I got.
Interesting...
When a class is in the same file, the following is produced:
var _marked = [someGenerator].map(_regeneratorRuntime.mark);
Without a class, it is transformed correctly:
var _marked = [someGenerator].map(_regenerator2.default.mark);
Both still contain:
var _regenerator = __webpack_require__(/*! ./~/babel-preset-react-app/~/babel-runtime/regenerator */ 89);
var _regenerator2 = _interopRequireDefault(_regenerator);
The stray _regeneratorRuntime is the only token with that name in the entire bundle...
Seems like transform-runtime is misbehaving.
I wonder if we can reproduce this with an even more minimal project strictly using the babel chain ...
This looks related. https://github.com/babel/babel/issues/5655
Looks very related, I see the same stray _regeneratorRuntime. 😄
Thanks for digging into that, @angelbeltran!
It would be great to check if it still happens on master.
This does not reproduce in master. I’m assuming it was fixed by disabling CommonJS transform.
I could reproduce using [email protected] with the same sample code provided by @angelbeltran. However I could not reproduce on latest master commit (5ecda24f76a0d64aba98f3f5059e25e1a9695ce6) using npm start.
Edit: Sorry didn't see your post @gaearon
Thanks, guys!