Thanks to visit codestin.com
Credit goes to github.com

Skip to content

for await is not supported when targeting es2018 #21196

Closed
@JounQin

Description

@JounQin

Bug Report

Affected Package

The issue is caused by package @angular-devkit/build-angular

Is this a regression?

No

Description

As title

Minimal Reproduction

https://github.com/JounQin/test/blob/angular/src/main.ts#L19

Exception or Error


./src/main.ts:18:8 - Error: Module parse failed: Unexpected token (18:8)
File was processed with these loaders:
 * ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
 * ./node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js
 * ./node_modules/@ngtools/webpack/src/ivy/index.js
You may need an additional loader to handle the result of these loaders.
|     console.log(result);
| 
>     for await (const i of [1, 2, 3]) {
|       console.log(i);
|     }

Your Environment

Angular Version:


Angular CLI: 12.0.5
Node: 12.22.1
Package Manager: yarn 1.22.10
OS: darwin x64

Angular: 12.0.5
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1200.5
@angular-devkit/build-angular   12.0.5
@angular-devkit/core            12.0.5
@angular-devkit/schematics      12.0.5
@schematics/angular             12.0.5
rxjs                            7.1.0

Anything else relevant?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions