When using the babel-plugin-transform-async-to-promises along with @babel/preset-env targeting an ES5 environment (such as IE 11) variables can be assigned without first being declared which causes the following error/s:
ReferenceError: assignment to undeclared variable varname
Babel's scope tracking got more strict in babel 7.6 and broke the tracking of variables across functions; this is now remedied in master and will be in the next release.
When using the
babel-plugin-transform-async-to-promises
along with@babel/preset-env
targeting an ES5 environment (such as IE 11) variables can be assigned without first being declared which causes the following error/s:I have created a minimum test case demonstrating this issue here: https://github.com/i-like-robots/broken-babel-async-await-transform-test-case
There appears to be several ways to mitigate the issue as manifested in the example above:
var
syntax (not an option for us)export default
statement to another line (most practical but in our case would require changes to number of code bases across our projects)This may be a duplicate of #38