Why does my Angular application give an error when run on StackBlitz?

2.1k Views Asked by At

I have an Angular application that runs fine on my machine using ng serve, but when I run it on StackBlitz:

https://stackblitz.com/github/nickhodges/primedirective

I get the following error:

Error in /turbo_modules/@angular/[email protected]/bundles/compiler.umd.js (2617:21)
Can't resolve all parameters for ApplicationModule: (?).

I have updated the dependencies on the StackBlitz editor, and it still doesn't work, giving a slightly different error.

Error in /turbo_modules/@angular/[email protected]/bundles/compiler.umd.js (2497:21)
Can't resolve all parameters for ApplicationModule: (?).

Anyone have any idea why this error occurs on StackBlitz?

2

There are 2 best solutions below

2
On BEST ANSWER

import 'core-js/es7/reflect'; include this line in your polyfills.ts

visit the link its working now https://github-pigpd9.stackblitz.io and https://stackblitz.com/edit/github-pigpd9 (editorial url)

3
On

yes this is because we have to import

import 'core-js/es7/reflect';

in our polyfils.ts file. after including this it will work.

there is only one reason why it's happing and you can read that reason in the introduction to angular 7

this is happening when we upgrade Angular 5 to Angular 7