Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

target: es2020 doesn't work with ?. null conditional operator #18204

Closed
vivainio opened this issue Jul 9, 2020 · 5 comments
Closed

target: es2020 doesn't work with ?. null conditional operator #18204

vivainio opened this issue Jul 9, 2020 · 5 comments

Comments

@vivainio
Copy link

vivainio commented Jul 9, 2020

馃悶 bug report

Affected Package

@angular/cli

Is this a regression?

No

Description

?. operator doesn't work if you set target: "ES2020" in tsconfig.base.json

馃敩 Minimal Reproduction

Check out https://github.com/vivainio/repro-angular-es2020-fail

run "ng build" and observe the compiler error.

If you change it back to "target": "es2016", ng build succeeds.

馃敟 Exception or Error


ERROR in ./src/app/app.component.ts 38:20
Module parse failed: Unexpected token (38:20)
File was processed with these loaders:
 * ./node_modules/@ngtools/webpack/src/index.js
You may need an additional loader to handle the result of these loaders.
|         this.title = 'test2020';
|         const a = undefined;
>         const b = a?.name;
|     }
| }

馃實 Your Environment

Angular Version:



Angular CLI: 10.0.1
Node: 12.18.1
OS: win32 x64

Angular: 10.0.3
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.1000.1
@angular-devkit/build-angular     0.1000.1
@angular-devkit/build-optimizer   0.1000.1
@angular-devkit/build-webpack     0.1000.1
@angular-devkit/core              10.0.1
@angular-devkit/schematics        10.0.1
@angular/cli                      10.0.1
@ngtools/webpack                  10.0.1
@schematics/angular               10.0.1
@schematics/update                0.1000.1
rxjs                              6.5.5
typescript                        3.9.6
webpack                           4.43.0

Anything else relevant?

I'm aware that native async/await is not supported by Zone.js, but for the purposes of this discussions I don't care about this gap.

@JoostK
Copy link
Member

JoostK commented Jul 9, 2020

This is not currently supported in Webpack, see webpack/webpack#10227

@JoostK JoostK transferred this issue from angular/angular Jul 9, 2020
@JoostK
Copy link
Member

JoostK commented Jul 9, 2020

Transferred to the CLI repo, however this is not actionable for the CLI at the moment.

@JoostK JoostK added state: blocked on upstream freq1: low Only reported by a handful of users who observe it rarely labels Jul 9, 2020
@vivainio
Copy link
Author

vivainio commented Jul 9, 2020

As instructed in webpack/webpack#10227, changing "target" to "es2019" is a functional workaround

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Jul 9, 2020

Let鈥檚 continue tracking this issue as part of: #17555

Since this will only be fixed in Webpack 5.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Aug 9, 2020
@alan-agius4 alan-agius4 removed state: blocked on upstream freq1: low Only reported by a handful of users who observe it rarely labels Sep 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants