Open osban opened 4 years ago
Hello, I ran into the following issue:
const testarray = [ {id: 1, name: 'foo'}, {id: 2, name: 'bar'} ] const doarray = [2]
const test = async () => { for (let i=0; i < doarray.length; i++) { const a = testarray.findIndex(x => x.id === doarray[i]) await Promise.resolve(console.log(a)) } } test()
result: Error: Cannot use keyword 'await' outside an async function. 2. code: ```js const testarray = [ {id: 1, name: 'foo'}, {id: 2, name: 'bar'} ] const doarray = [2] const test = async () => { const geta = i => testarray.findIndex(x => x.id === doarray[i]) for (let i=0; i < doarray.length; i++) { const a = geta(i) await Promise.resolve(console.log(a)) } } test()
result: compiles fine.
This was encountered using Rollup 2.21.0 and @rollup/plugin-buble 0.21.3 (Windows 10), with:
transforms: {asyncAwait: false}
Hello, I ran into the following issue:
const test = async () => { for (let i=0; i < doarray.length; i++) { const a = testarray.findIndex(x => x.id === doarray[i]) await Promise.resolve(console.log(a)) } } test()
result: compiles fine.
This was encountered using Rollup 2.21.0 and @rollup/plugin-buble 0.21.3 (Windows 10), with: