I have this polyfill.ts file in my app that have these import statements:
import 'zone.js/dist/zone';
import 'core.js';
import 'core-js/modules/es6.map';
import 'regenerator-runtime/runtime';
import 'core-js/es6/reflect';
But upon checking on the console log, it has an Uncaught TypeError in the polyfill.js file (note: error on polyfill.js file, not on the polyfill.ts file)
Is there a way to not load these polyfill files? Is it also possible to delete this polyfill.ts file even though it is auto-created?
When building the project,polyfill.ts
is used to create polyfill.js
build artifact which contains all the polyfills required to support a missing functionality in older browsers.
Is it also possible to delete this polyfill.ts
Try to avoid deleting this file because polyfill.ts contains zone.js
polyfill. Your app may produce errors when running on older browsers. You can however remove the ones not required by your project.
Here is the summary of what these polyfills do:
import 'zone.js/dist/zone'; : Internally required by angular to create a wrapper around async tasks for change detection & angular renderer to work properly on older browsers.
import 'core.js'; import 'core-js/es6/reflect'; import 'core-js/modules/es6.map'; : Useful for IE support which misses many of the modern ES6 functionalities. You can remove these if you don't support IE.
import 'regenerator-runtime/runtime'; : Adds polyfill for generator/yield functions.