From 71882310325e63eefa1a5b951b5e4bf1e2e5411f Mon Sep 17 00:00:00 2001 From: Oliver Schwede Date: Mon, 1 Jul 2019 16:42:31 +0200 Subject: [PATCH 1/3] Sandbox promises to fix issues with other global polyfills. --- rollup.config.js | 2 -- src/index.js | 2 -- src/worker.js | 1 + 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/rollup.config.js b/rollup.config.js index 06d3cb6..6c81deb 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -33,7 +33,6 @@ export default [ external: [ 'jspdf', 'html2canvas', - 'es6-promise/auto' ], globals: { jspdf: 'jsPDF', @@ -57,7 +56,6 @@ export default [ external: [ 'jspdf', 'html2canvas', - 'es6-promise/auto' ], globals: { jspdf: 'jsPDF', diff --git a/src/index.js b/src/index.js index 12a4d1a..1b82157 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,3 @@ -import 'es6-promise/auto'; - import Worker from './worker.js'; import './plugin/jspdf-plugin.js'; import './plugin/pagebreaks.js'; diff --git a/src/worker.js b/src/worker.js index 37a2834..8cc3d35 100644 --- a/src/worker.js +++ b/src/worker.js @@ -1,6 +1,7 @@ import jsPDF from 'jspdf'; import html2canvas from 'html2canvas'; import { objType, createElement, cloneNode, toPx } from './utils.js'; +var Promise = require('es6-promise').Promise; /* ----- CONSTRUCTOR ----- */ From 7b3457c546670714d38d06dc5625d027ca4e4dcd Mon Sep 17 00:00:00 2001 From: Oliver Schwede Date: Mon, 1 Jul 2019 17:22:30 +0200 Subject: [PATCH 2/3] Use proper import instead of require. --- src/worker.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/worker.js b/src/worker.js index 8cc3d35..ee40224 100644 --- a/src/worker.js +++ b/src/worker.js @@ -1,7 +1,8 @@ import jsPDF from 'jspdf'; import html2canvas from 'html2canvas'; import { objType, createElement, cloneNode, toPx } from './utils.js'; -var Promise = require('es6-promise').Promise; +import es6promise from 'es6-promise'; +var Promise = es6promise.Promise; /* ----- CONSTRUCTOR ----- */ From 263f54f9dcc8818f333f28f8b794c590fec8c2d4 Mon Sep 17 00:00:00 2001 From: Oliver Schwede Date: Mon, 8 Jul 2019 08:40:48 +0200 Subject: [PATCH 3/3] Add es6-promise to globals in rollup config. --- rollup.config.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rollup.config.js b/rollup.config.js index 6c81deb..3b2c853 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -35,6 +35,7 @@ export default [ 'html2canvas', ], globals: { + 'es6-promise': 'es6promise', jspdf: 'jsPDF', html2canvas: 'html2canvas' }, @@ -58,6 +59,7 @@ export default [ 'html2canvas', ], globals: { + 'es6-promise': 'es6promise', jspdf: 'jsPDF', html2canvas: 'html2canvas' }, @@ -79,6 +81,7 @@ export default [ { file: pkg.browser.replace(/js$/, 'bundle.js'), format: 'umd' } ], globals: { + 'es6-promise': 'es6promise', jspdf: 'jsPDF', html2canvas: 'html2canvas' }, @@ -98,6 +101,7 @@ export default [ { file: pkg.browser.replace(/js$/, 'bundle.min.js'), format: 'umd' } ], globals: { + 'es6-promise': 'es6promise', jspdf: 'jsPDF', html2canvas: 'html2canvas' },