1

I'm getting the run time error below after upgrading our Angular application from Angular 7.2 to Angular 8.1 and updating core-js from 2.6.2 to 3.1.4. Our application does not use the Angular CLI, we just use webpack directly. Keeping the core-js version at 2.6.2 works just fine. What is the proper way of loading this polyfill manually with the new version of core-js?

The old polyfill.ts would load core-js as follows:

import 'core-js/es6';
import 'core-js/es7/reflect';

I tried the following with the new core-js but no luck:

import 'core-js/es'
import 'core-js/es/reflect'

Error:

Uncaught Error: Can't resolve all parameters for Location: (?, ?).
at syntaxError (webpack-internal:///./node_modules/@angular/compiler/fesm5/compiler.js:2687)
at CompileMetadataResolver._getDependenciesMetadata (webpack-internal:///./node_modules/@angular/compiler/fesm5/compiler.js:21589)
at CompileMetadataResolver._getTypeMetadata (webpack-internal:///./node_modules/@angular/compiler/fesm5/compiler.js:21481)
at CompileMetadataResolver._getInjectableTypeMetadata (webpack-internal:///./node_modules/@angular/compiler/fesm5/compiler.js:21704)
at CompileMetadataResolver.getProviderMetadata (webpack-internal:///./node_modules/@angular/compiler/fesm5/compiler.js:21713)
at eval (webpack-internal:///./node_modules/@angular/compiler/fesm5/compiler.js:21651)
at Array.forEach (<anonymous>)
at CompileMetadataResolver._getProvidersMetadata (webpack-internal:///./node_modules/@angular/compiler/fesm5/compiler.js:21611)
at eval (webpack-internal:///./node_modules/@angular/compiler/fesm5/compiler.js:21613)
at Array.forEach (<anonymous>)

2 Answers 2

2

I was able to solve the issue after reading the core-js version 3 change log and other articles. This change to how I import the core-js polyfill in polyfill.ts resolved the runtime issue mentioned above:

import 'core-js/es';
import 'core-js/proposals/reflect-metadata';
Sign up to request clarification or add additional context in comments.

Comments

0

Default angular 8 polyfill doesnt contain core-js because the framework already handle core-js it's self so you can remove core-js import in your polyfill

1 Comment

I removed the core-js from my polyfill.ts file.. same error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.