@@ -279,7 +279,8 @@ export function writePolyfills(outputDirectory: string) {
279279 'node_modules/core-js/es7/reflect.js' ,
280280 'node_modules/core-js/es6/reflect.js' ,
281281 'node_modules/zone.js/dist/zone.js' ,
282- 'scripts/polyfill/polyfill.dom.js'
282+ 'scripts/polyfill/polyfill.dom.js' ,
283+ 'node_modules/tslib/tslib.js'
283284 ] ;
284285
285286 const ALL_ENTRIES = [
@@ -302,22 +303,54 @@ export function writePolyfills(outputDirectory: string) {
302303 'node_modules/core-js/es6/weak-set.js' ,
303304 'node_modules/core-js/es7/reflect.js' ,
304305 'node_modules/zone.js/dist/zone.js' ,
305- 'scripts/polyfill/polyfill.dom.js'
306+ 'scripts/polyfill/polyfill.dom.js' ,
307+ 'node_modules/tslib/tslib.js'
306308 ] ;
307309
308310 const NG_ENTRIES = [
309311 'node_modules/core-js/es7/reflect.js' ,
310312 'node_modules/zone.js/dist/zone.js' ,
313+ 'node_modules/tslib/tslib.js'
314+ ] ;
315+
316+ const ZONE_ONLY = [
317+ 'node_modules/zone.js/dist/zone.js' ,
311318 ] ;
312319
313320 let promises = [ ] ;
314321 promises . push ( bundlePolyfill ( MODERN_ENTRIES , join ( outputDirectory , 'polyfills.modern.js' ) ) ) ;
315322 promises . push ( bundlePolyfill ( ALL_ENTRIES , join ( outputDirectory , 'polyfills.js' ) ) ) ;
316323 promises . push ( bundlePolyfill ( NG_ENTRIES , join ( outputDirectory , 'polyfills.ng.js' ) ) ) ;
317-
318- return Promise . all ( promises ) ;
324+ promises . push ( bundlePolyfill ( ZONE_ONLY , join ( outputDirectory , 'polyfills.zone.js' ) ) ) ;
325+
326+ return Promise . all ( promises ) . then ( ( ) => {
327+ const promises = [ ] ;
328+ promises . push ( appendZoneUpdatesToPolyfill ( join ( outputDirectory , 'polyfills.modern.js' ) ) ) ;
329+ promises . push ( appendZoneUpdatesToPolyfill ( join ( outputDirectory , 'polyfills.js' ) ) ) ;
330+ promises . push ( appendZoneUpdatesToPolyfill ( join ( outputDirectory , 'polyfills.ng.js' ) ) ) ;
331+ promises . push ( appendZoneUpdatesToPolyfill ( join ( outputDirectory , 'polyfills.zone.js' ) ) ) ;
332+ return Promise . all ( promises ) ;
333+ } ) ;
319334} ;
320335
336+ function appendZoneUpdatesToPolyfill ( filePath : string ) {
337+ return readFileAsync ( filePath ) . then ( ( fileContent : string ) => {
338+ const updated = disablePartsOfZone ( fileContent ) ;
339+ return writeFileAsync ( filePath , updated ) ;
340+ } ) ;
341+ }
342+
343+ function disablePartsOfZone ( fileContent : string ) {
344+ const zoneContent = `__Zone_disable_Error = true;
345+ __Zone_disable_on_property = true;
346+ __Zone_disable_geolocation = true;
347+ __Zone_disable_toString = true;
348+ __Zone_disable_blocking = true;
349+ __Zone_disable_PromiseRejectionEvent = true;` ;
350+ return `${ zoneContent }
351+ ${ fileContent } ` ;
352+ }
353+
321354function bundlePolyfill ( pathsToIncludeInPolyfill : string [ ] , outputPath : string ) {
322355 return rollup ( {
323356 entry : pathsToIncludeInPolyfill ,
0 commit comments