angular14angular14upgrade

caught SyntaxError: Strict mode code may not include a with statement Angular 14 and I removed the file creating the error but it's still happening


I have removed the culprit line of code

export { renderModule, renderModuleFactory } from '@angular/platform-server';

and followed exactly what to do here...

Uncaught SyntaxError: Strict mode code may not include a with statement

and yet, I STILL get the error

caught SyntaxError: Strict mode code may not include a with statement

This is using Angular 14.2.0 and it makes absolutely no sense.

I don't understand.

UPDATE:

This problem happens on COMPILE and it appears 5 times in the babel-webpack folder under .angular folder. THIS IS THE PROBLEM. I've tried deleting the .angular folder but it simply rebuilds the same 5 "with (" statements. NOTE: with ( is how I searched.


Solution

  • I found the problem and the solution!

    By adding this... babel-preset-es2015-without-strict here...https://www.npmjs.com/package/babel-preset-es2015-without-strict

    ceased the strict mode error.

    Also, by lowering ES2022 down to 2020 further solved the problem.