-
Notifications
You must be signed in to change notification settings - Fork 12k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some unsupported code with es2015 target set #22270
Comments
The occurrence of I'm afraid that without more insight into your building process, we'd be unable to help you. Please share a reproduction. |
@JoostK Just create an empty project with angular cli 13.0.3. Change the tsconfig.json target to es2015. ng serve. You will see the problematic code in vendor.js:8571. |
What version of Chrome are you using? |
@JoostK If I change the target to es5, the problem gone. If it's a compiled library code, why?
I supposed ?. is a feature introduced in es10(2019). |
The optional chaining support landed in Chrome 80, quite a while ago. Angular only supports the latest major of Chrome; if OBS is using an outdated version then Angular apps may break in unexpected ways. The CLI has some heuristics to determine the output format to generate. It looks like it treats es5 targets differently than es2015. @alan-agius4 probably knows more about this, the output format of libraries might also depend on the browserslist configuration. |
In case the target is ES2019 or lower we should favour the FESM2015 entry-point. |
I don't have a horse in the race, but I am curious. If Angular only supports the latest major Chrome release, why do they still distribute / compile to (optionally) downleveled code? |
Agreed. Angular should be a general web development platform for all users instead of latest chrome users. |
Sorry, my comment was ambiguous: I didn't mean to say that only Chrome is supported, I meant say that specifically for Chrome we only support the latest major. That means that we test against it to verify that things work, it doesn't mean that we're actively breaking older versions (except for IE11, for which support was dropped in Angular 13) |
Ah, that makes more sense. So, are the "heuristics" the CLI uses to choose which packaging to use documented somewhere public-facing? I've always been kind of curious about the console output I see during a build, "Compiling @angular/core : es2015 as esm2015" etc. |
…plication targets ES2019 or lower Previously, we always consumed the ES2020 entrypoints, which caused issues in environments where the application compilation target is ES2019 or lower and ES2020 is not supported. This is because we only downlevel code when we target ES5 or below. - ES5 or below compilations, ES2015 entrypoints are used and their code is downlevelled to ES5. - ES2019 or below, ES2015 entrypoints are used and no downlevelling is involved. - ES2020 or later, ES2020 entrypoints are used. Closes #22270
…plication targets ES2019 or lower Previously, we always consumed the ES2020 entrypoints, which caused issues in environments where the application compilation target is ES2019 or lower and ES2020 is not supported. This is because we only downlevel code when we target ES5 or below. - ES5 or below compilations, ES2015 entrypoints are used and their code is downlevelled to ES5. - ES2019 or below, ES2015 entrypoints are used and no downlevelling is involved. - ES2020 or later, ES2020 entrypoints are used. Closes #22270
@alan-agius4 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Which @angular/* package(s) are the source of the bug?
common
Is this a regression?
No
Description
This is not supported for es2015. But it's still there after compile. I'm trying to write a webpage for OBS studio. The ?. is not supported I think. And I think it's not in es2015 as well.
Here is the tsconfig. Set target to es2015 doesn't help. But the unsupported is gone if I set target to es5.
https://github.com/angular/angular/blob/b5ab7aff433a67cddaa55e621d17b1a1b07b57c2/packages/common/src/location/location_strategy.ts#L176-L178
Why this ?. is kept even I set target to es2015?
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run
ng version
)No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: