In angular cli, there is a file named es2015-polyfill.js, inside this file, all polyfill for es5 legacy browsers will be there, so with zone evergreen bundle, the most idle way to handle this is.
put a zone-legacy.js inside es2015-polyfill.js.
put zone-evergreen.js inside polyfill.ts.
So
in es5 legacy browser, it will load zone-legacy.js + zone-evergreen.js.
in modern browser, it will only load zone-evergreen.js.
Before this PR, zone-legacy.js need to be loaded after zone-evergreen.js, because the zone-legacy use a lot of common logic from zone-evergreen.js. So in this PR,
zone-legacy.js is a lazy load module which will only define a factory function.
When zone-evergreen.js loading, it will check whether this lazy load module exist, if exists, it will execute the zone-legacy patch logic.
In
angular cli
, there is a file namedes2015-polyfill.js
, inside this file, allpolyfill
fores5 legacy browsers
will be there, so withzone evergreen bundle
, the most idle way to handle this is.zone-legacy.js
insidees2015-polyfill.js
.zone-evergreen.js
insidepolyfill.ts
.So
es5 legacy browser
, it will loadzone-legacy.js
+zone-evergreen.js
.modern browser
, it will only loadzone-evergreen.js
.Before this PR,
zone-legacy.js
need to be loaded afterzone-evergreen.js
, because thezone-legacy
use a lot ofcommon logic
fromzone-evergreen.js
. So in this PR,zone-legacy.js
is alazy load module
which will only define afactory function
.zone-evergreen.js
loading, it will check whether thislazy load module exist
, if exists, it will execute thezone-legacy patch logic
.