Angular-cli: Error with core-js after upgrading to Angular 8.0

Created on 29 May 2019  路  9Comments  路  Source: angular/angular-cli

After ng update I upgraded to Angular 8.0. When I try to run my app I get:

ERROR in ./src/polyfills.ts
Module not found: Error: Can't resolve 'core-js/es6/reflect'

Most helpful comment

Inside polyfills.ts I updated this line:
import 'core-js/es6/reflect';

To this one:
import 'core-js/es/reflect';

And worked like a charm...

All 9 comments

Inside polyfills.ts I updated this line:
import 'core-js/es6/reflect';

To this one:
import 'core-js/es/reflect';

And worked like a charm...

@mhosman Just to inform you, you can remove that line entirely. The polyfills are now handled by Angular CLI itself.

@sarunint I tried it your way (removed the line) and it worked fine with ng serve, but after building and running in Chrome I get

Uncaught TypeError: Reflect.getMetadata is not a function

Should I write up a bug or are you possibly mistaken?

Edit: Nevermind, I get it both ways after ng build :-/

@sarunint
I've read over here too, that states core-js is handled by CLI, so there's no need to add as dependencies.

I've remove core-js from my package.js, and build the project, then serve.
However i'm facing same issue as @adamdport

I'm not sure if it's my configuration issue, or it's a Bug

@mhosman Just to inform you, you can remove that line entirely. The polyfills are now handled by Angular CLI itself.

can we remove all other lines or also that file?

ERROR in ./src/polyfills.ts
Module not found: Error: Can't resolve 'core-js/es7/reflect' in 'C:\my-project\src'
I am getting this error. How can I resolve this?

https://github.com/angular/angular-cli/issues/14542#issuecomment-496737123 or

// Uncaught TypeError: Reflect.getMetadata is not a function
import 'core-js/proposals/reflect-metadata';

depends on what you need

_PS: https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md_

ERROR in ./src/polyfills.ts
Module not found: Error: Can't resolve 'core-js/es7/reflect' in 'F:\JSON\angular-json-crud\src'

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings