From 34675c4691039793660fac7e1fa257d02c42f10b Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Sat, 4 Mar 2017 07:36:15 +0530 Subject: [PATCH 1/2] Add a global Promise polyfill. This is because Webpack2 depends on it. --- client/next.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client/next.js b/client/next.js index 5400a409161c..c9969d035c4f 100644 --- a/client/next.js +++ b/client/next.js @@ -1,3 +1,12 @@ import next from './' +// Polyfill Promise globally +// This is needed because Webpack2's dynamic loading(common chunks) code +// depends on Promise. +// So, we need to polyfill it. +// See: https://github.com/webpack/webpack/issues/4254 +if (!window.Promise) { + window.Promise = Promise +} + next() From 93425f49d5720470df73638dda85be4c072aa0c6 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Sat, 4 Mar 2017 07:44:57 +0530 Subject: [PATCH 2/2] Change the polyfill location. --- client/index.js | 9 +++++++++ client/next.js | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/client/index.js b/client/index.js index 0e0438b7736f..6a453e503924 100644 --- a/client/index.js +++ b/client/index.js @@ -7,6 +7,15 @@ import App from '../lib/app' import evalScript from '../lib/eval-script' import { loadGetInitialProps, getURL } from '../lib/utils' +// Polyfill Promise globally +// This is needed because Webpack2's dynamic loading(common chunks) code +// depends on Promise. +// So, we need to polyfill it. +// See: https://github.com/webpack/webpack/issues/4254 +if (!window.Promise) { + window.Promise = Promise +} + const { __NEXT_DATA__: { component, diff --git a/client/next.js b/client/next.js index c9969d035c4f..5400a409161c 100644 --- a/client/next.js +++ b/client/next.js @@ -1,12 +1,3 @@ import next from './' -// Polyfill Promise globally -// This is needed because Webpack2's dynamic loading(common chunks) code -// depends on Promise. -// So, we need to polyfill it. -// See: https://github.com/webpack/webpack/issues/4254 -if (!window.Promise) { - window.Promise = Promise -} - next()