1

After updating Angular to version 15, where the target of compilerOptions is automatically set to ES2022, my angular web component is not working anymore for Chrome 53.

This error is showing in console: Uncaught SyntaxError: Unexpected token {

I am importing the following polyfills:

  • custom-elements-es5-adapter.js
  • webcomponents-bundle.js

I tried to lower the Chrome version in browserlist, but this has no affect. Changing the target doesn't help either, because Angular CLI sets it back to es2022 and shows this message: TypeScript compiler options "target" and "useDefineForClassFields" are set to "ES2022" and "false" respectively by the Angular CLI.

Does somebody know how to let angular web components work again on old Chrome browsers for Angular 15?

NiZa
  • 3,806
  • 1
  • 21
  • 29

1 Answers1

1

it is possible that for Angular 15 the Typescript version is also to upgrade to (4.2) it has new features and improvements and your code is possibly not fully compatible, maybe you have to adjust the code a bit

PicCOD_OFF
  • 51
  • 4
  • Typescript has been updated with one minor version indeed, but then I would expect a type error. Now I am getting `Uncaught SyntaxError: Unexpected token {` error – NiZa Dec 23 '22 at 13:50
  • Where do you get the error on which file ? – PicCOD_OFF Dec 23 '22 at 19:53
  • At all files that I import and are compiled in target es2022 that are needed to render the web component – NiZa Dec 24 '22 at 09:14
  • it can be another problem with webpack which can be another problem puzzle to solve these issues, please try to update the wepack version and try to delete the node modules and reinstall it. – PicCOD_OFF Dec 24 '22 at 15:14
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 25 '22 at 09:44