Is not core-js needed anymore?

If you look in src/polyfills.ts in an Angular 7 or earlier project, you'll see a bunch of comments and commented out import statements that allow you to add polyfills for various browsers by uncommenting them - most come from core.js.

In Angular 8, with the advent of Differential Loading, the CLI will build 2 bundles - one with and one without polyfills, based on your requirements in the browserslist file and your tsconfig file.

The Angular CLI handles differential loading for you as part of the build process for deployment. The ng build command produces the necessary bundles used for differential loading, based on your browser support requirements and compilation target.

The difference with core-js in ng8 is that, since the CLI is handling polyfills, core-js is a dependency of the CLI. So even if you uninstall core-js as part of upgrading to ng8, you'll see it's still in your node_modules folder, but you won't have to manage which version is installed.

After you've upgraded your project and the CLI to angular 8, I would suggest you do this:

  1. replace the contents of polyfills.ts with the contents of the same file in a newly generated ng8 or later project
  2. Uninstall core-js from your project.

Now you can build your project and the CLI takes care of the polyfills.


According to this article.

Note that core-js has been updated to v3, and is now directly handled by the CLI itself, so it’s no longer needed as a dependency of your application.