2

After downgrading my Angular project from version 7 to 6 and integrating Angular Universal with the help of @ngToolkit, I'm getting the following error message in the browser console:

Can't resolve all parameters for Application Module: (?). at syntaxError (compiler.js:1021)

I downgraded the project by simply overwriting the dependencies like described here. As already described the error only occurs in the browser console, while to compilation of the project is completing successfully.

Alexander Belokon
  • 1,452
  • 2
  • 17
  • 37
  • 1
    https://github.com/angular/angular/issues/26128 – gsc Apr 09 '19 at 10:47
  • 1
    Thank you, your reference helped a lot. There were actually some Polyfills missing, so I copied the polyfill.ts from a different project with Angular 6 and that fixed it. Would you mind writing an answer for future reference to help people with the same error message? – Alexander Belokon Apr 09 '19 at 12:57

1 Answers1

3

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

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.

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).

gsc
  • 1,559
  • 1
  • 13
  • 17
  • What does the import statement look like? import reflect from 'reflect-metadata'? – Jackie Sep 10 '20 at 17:24
  • @Jackie, I used just `import 'reflect-metadata'` in `index.ts` and `import 'core-js/es7/reflect'` in `polyfills.ts`. Your setup may require something different. – gsc Sep 11 '20 at 19:28