Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I have recently updated to Angular v9 and I am getting the following error:

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

This is occuring in the following file:

./node_modules/@angular/animations/__ivy_ngcc__/fesm2015/animations.js

This is an Angular v9 file as per the comments in the file:

/** * @license Angular v9.0.0 * (c) 2010-2020 Google LLC. https://angular.io/ * License: MIT */

This is occuring here, with the with statement:

module.exports = {   Window_run: function _run(code, file) {     if (file) code += '\n//@ sourceURL=' + file;     with(this) eval(code);   }, 

There is a comment above this line:

/* Domino uses sloppy-mode features (in particular, with) for a few * minor things. This file encapsulates all the sloppiness; every * other module should be strict. / / jshint strict: false / / jshint evil: true / / jshint -W085 */

like image 987
Patrick Avatar asked Feb 07 '20 13:02

Patrick


1 Answers

I was searching for the solution to a similar problem. Upgrade to Angular 9 broke my app. After a lot of trial and error this helped me.

Just comment out or remove the following line from main.ts (added by the upgrade process):

export { renderModule, renderModuleFactory } from '@angular/platform-server'; 
like image 147
wpfwannabe Avatar answered Sep 25 '22 07:09

wpfwannabe