#Force Angular CLI target to "es5" to support deprecated Browser (Firefox 42)

14 messages · Page 1 of 1 (latest)

maiden shoal
#

Hello everyone,

I'm currently trying to migrate the Angular Version from 12 to 15.
At the moment I am at Angular 15 but got some trouble running my application even tho I followed the migration guides closely.

The App works for newer Browser but throws Syntax Errors if used with Firefox 42.
I've already setup the es5 support in the Version 12 Migration but for the current Migration (15) the Angular CLI forces the target to be "ES2022".

I know that this is Deprecated and not suggested but I need to be able to run the application in this specific Browser.

How do I force the CLI to use es5?

Thanks in advance

Leku

paper timber
#

What errors are you getting?

maiden shoal
#

I get TypeScript compiler options "target" and "useDefineForClassFields" are set to "ES2022" and "false" respectively by the Angular CLI. even tho I've set it to es5 in the tsconfig

#

According to Google as well as ChatGPT it isn't possible to use es5 with Angular 15 (at least out of the box).
My current solution is to use Babel to transpile down from ES2022 to es5 - this kind of works but I feel like there is a better solution.

dense pawn
maiden shoal
#

As always it's a Client Wish because their infrastructure is (of course) outdated.. And upgrading their system is no possibility. So I have to figure this out

#

I mean I've added Firefox and the other Browsers I want to support in the .browserlistrc but as you can tell that doesn't benefits me much in this case

dense pawn
#

I have no idea if you're in a position to tell them, but using such old browsers is a security risk, and a pain for developers. The best thing to do, for themselves, it to upgrade. And if they don't, you should charge them more for the hassle they impose.

#

What have you added to .browserslistrc?

maiden shoal
#

Firefox 42 and the other more common and up to date browsers

#

The CLI explicitly tells me that Firefox 42 is not respected/considered

#

I mean I know for a fact that the Angular Version is simply not compatible with es5 as it is.
But as I said, I need to find a solution with this context.

I would be happy if the client would update their systems but that's not happening. (Big non tech company, not innovative - you see where this goes)

paper timber
#

Not helping much, i worked for clients who also believed blocking auto updating evergreen browsers is a good idea. But i do believe we have to keep explaining them that it's not.

But Firefox 42 is 8 years old. I do understand they cant update frequently, but 8 years when using a browser that should auto update normally?

Anyway, As of 12, angular dropped support for some older browsers, so im not sure it's gonna be easy (but i would also think support for Firefox 42 explicitly, has been dropped for years, but it worked fine because it supported ie11)

#

To try and be somewhat helpful..
Have you updated browserlist and tsconfig?