From 0b02500cfb75ea87df5e2df5b2afa719300bfb9c Mon Sep 17 00:00:00 2001 From: Monica Dinculescu Date: Tue, 17 Jan 2017 15:16:23 -0800 Subject: [PATCH] fix IE11 build --- entrypoints/webcomponents-hi-ce-sd-pf-index.js | 2 +- gulpfile.js | 16 ++++++++++++---- tests/integration.html | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/entrypoints/webcomponents-hi-ce-sd-pf-index.js b/entrypoints/webcomponents-hi-ce-sd-pf-index.js index d895bbb..d5f5602 100644 --- a/entrypoints/webcomponents-hi-ce-sd-pf-index.js +++ b/entrypoints/webcomponents-hi-ce-sd-pf-index.js @@ -17,7 +17,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN import '../bower_components/webcomponents-platform/webcomponents-platform.js' import '../bower_components/URL/url.js' import '../bower_components/template/template.js' -import '../bower_components/es6-promise/lib/es6-promise.js' +import '../bower_components/es6-promise/dist/es6-promise.auto.min.js' import '../bower_components/html-imports/src/html-imports.js' import '../src/pre-polyfill.js' import '../bower_components/custom-elements/custom-elements.min.js' diff --git a/gulpfile.js b/gulpfile.js index 11f2348..93bb22b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -33,16 +33,24 @@ const babiliConfig = { shouldPrintComment: singleLicenseComment() }; -function minify(sourceName, fileName) { +function minify(sourceName, fileName, needsContext) { if (!fileName) fileName = sourceName; - return rollup({ + var options = { entry: './entrypoints/' + sourceName + '-index.js', format: 'iife', moduleName: 'webcomponentsjs', sourceMap: true - }) + } + + // The es6-promise polyfill needs to set the correct context. + // See https://github.com/rollup/rollup/wiki/Troubleshooting#this-is-undefined + if (needsContext) { + options.context = 'window'; + }; + + return rollup(options) .pipe(source(sourceName +'-index.js')) .pipe(buffer()) .pipe(sourcemaps.init({loadMaps: true})) @@ -69,7 +77,7 @@ gulp.task('minify-hi-ce-sd', () => { }); gulp.task('minify-hi-ce-sd-pf', () => { - minify('webcomponents-hi-ce-sd-pf', 'webcomponents-lite') + minify('webcomponents-hi-ce-sd-pf', 'webcomponents-lite', true) }); gulp.task('default', ['minify-none', 'minify-hi', 'minify-hi-ce', 'minify-hi-ce-sd', 'minify-hi-ce-sd-pf']); diff --git a/tests/integration.html b/tests/integration.html index 242cf57..ad52963 100644 --- a/tests/integration.html +++ b/tests/integration.html @@ -10,7 +10,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN --> - Template with HTMLImports Test + Integration Test