-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Description
Expected Behavior
Using the async
keyword in scratch-vm
should either work correctly (requires changes in scratch-gui
I believe) or it should be forbidden by lint and/or webpack rules (requires changes in scratch-vm
).
Ideally, any error messages caused by using unsupported features should contain information about which unsupported feature was used, and where.
Actual Behavior
If async
is used anywhere in scratch-vm
then scratch-gui
crashes at runtime with a message similar to Uncaught ReferenceError: regeneratorRuntime is not defined
.
The message may appear immediately or may be delayed, depending on where the async
keyword appears in the scratch-vm
source code.
In some cases the error message may indicate the location of the async
keyword but in my experience it usually indicates GUI.render
with a deep React stack. The message doesn't contain any indication that the problem has anything to do with async
, unsupported features, or anything like that which is especially problematic when the call stack doesn't indicate the correct location either.
Steps to Reproduce
- In
scratch-vm
:- Place a line like this in just about any JavaScript file under
src
:const _foo = async function () { };
- Optionally, run
npm run lint
and note that there are no errors. - Run
npm run build
ornpm run watch
to build the modified code. Note that there are no errors. - Run
npm link
to register this copy ofscratch-vm
.
- Place a line like this in just about any JavaScript file under
- In
scratch-gui
:- Run
npm link scratch-vm
to link to the modifiedscratch-vm
. - Run
npm start
to start the webpack dev server. - Visit http://localhost:8601/ in a browser, ideally with the dev console open.
- Observe the
Uncaught ReferenceError: regeneratorRuntime is not defined
error in the console. Depending on where theasync
keyword is, you may or may not also see the "Oops! Something went wrong." screen.
- Run