我最近更新到 Angular v9,但收到以下错误:
未捕获的语法错误:严格模式代码可能不包含 with 语句
这发生在以下文件中:
./node_modules/@angular/animations/__ivy_ngcc__/fesm2015/animations.js
根据文件中的注释,这是一个 Angular v9 文件:
/** * @license Angular v9.0.0 * (c) 2010-2020 Google LLC。 https://angular.io/ * 许可证:麻省理工学院 */
这发生在这里,声明如下with:
module.exports = {
Window_run: function _run(code, file) {
if (file) code += '\n//@ sourceURL=' + file;
with(this) eval(code);
},
Run Code Online (Sandbox Code Playgroud)
这行上面有一条评论:
/* Domino 使用 sloppy-mode 功能(特别是
with)来处理一些*次要的事情。这个文件封装了所有的草率;每个其他模块都应该严格。// jshint strict: false // jshintvil: true // jshint -W085 */