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 or npm run watch to build the modified code. Note that there are no errors.
Run npm link to register this copy of scratch-vm.
In scratch-gui:
Run npm link scratch-vm to link to the modified scratch-vm.
Observe the Uncaught ReferenceError: regeneratorRuntime is not defined error in the console. Depending on where the async keyword is, you may or may not also see the "Oops! Something went wrong." screen.
Expected Behavior
Using the
async
keyword inscratch-vm
should either work correctly (requires changes inscratch-gui
I believe) or it should be forbidden by lint and/or webpack rules (requires changes inscratch-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 inscratch-vm
thenscratch-gui
crashes at runtime with a message similar toUncaught ReferenceError: regeneratorRuntime is not defined
.The message may appear immediately or may be delayed, depending on where the
async
keyword appears in thescratch-vm
source code.In some cases the error message may indicate the location of the
async
keyword but in my experience it usually indicatesGUI.render
with a deep React stack. The message doesn't contain any indication that the problem has anything to do withasync
, unsupported features, or anything like that which is especially problematic when the call stack doesn't indicate the correct location either.Steps to Reproduce
scratch-vm
:src
:const _foo = async function () { };
npm run lint
and note that there are no errors.npm run build
ornpm run watch
to build the modified code. Note that there are no errors.npm link
to register this copy ofscratch-vm
.scratch-gui
:npm link scratch-vm
to link to the modifiedscratch-vm
.npm start
to start the webpack dev server.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.