且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法解析应用程序模块的所有参数:(?).在语法错误 (compiler.js:1021) 站点:***.com

更新时间:2023-11-22 18:14:46

你显然受到了 issue 26128 在 Angular 6.1.8 中引入.作为 IgorMinar 解释(强调我的):

You’re apparently affected by issue 26128 that was introduced in Angular 6.1.8. As IgorMinar explained (emphasis mine):

我注意到,过去在某些情况下,您可以在没有 Reflect.metadata polyfill 的情况下使用 JIT 编译器.但是最近有一个变化 [...],我们现在要求你在从 @angular/core 导入任何东西之前加载它.这将由 cli v7 自动完成,因此更改对大多数用户来说是透明的,除非您有自定义的 polyfill 设置,在这种情况下您需要确保polyfill 在 Angular 之前加载.

I noticed that in the past under certain circumstances you were able to use the JIT compiler without the Reflect.metadata polyfill. But with a recent change […], we now require you to load it before anything from @angular/core is imported. This will be done automatically by cli v7 so the change will be transparent to most users, unless you have a custom polyfill setup in which case you need to ensure that the polyfill is loaded before Angular.

如果是 Angular ^6.1.8 ||^7.0.0 使用 Webpack(即不是 Angular CLI),您必须导入 reflect-metadata(在任何 @angular/core 导入之前 - 如上所述).

In case of Angular ^6.1.8 || ^7.0.0 with Webpack (i.e. not Angular CLI), you have to import reflect-metadata (before any @angular/core imports—as stated above).