Skip to content

Commit

Permalink
fix: Promise.prototype.finally is object (#16620)
Browse files Browse the repository at this point in the history
  • Loading branch information
tengmaoqing committed Aug 30, 2020
1 parent f17d435 commit 6926ab7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions packages/next/client/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import PageLoader, { looseToArray, StyleSheetTuple } from './page-loader'
import measureWebVitals from './performance-relayer'
import { createRouter, makePublicRouterInstance } from './router'

require('next/dist/build/polyfills/finally-polyfill.min')

/// <reference types="react-dom/experimental" />

declare let __webpack_public_path__: string
Expand All @@ -41,10 +43,6 @@ declare global {
type RenderRouteInfo = PrivateRouteInfo & { App: AppComponent }
type RenderErrorProps = Omit<RenderRouteInfo, 'Component' | 'styleSheets'>

if (!('finally' in Promise.prototype)) {
;(Promise.prototype as PromiseConstructor['prototype']).finally = require('next/dist/build/polyfills/finally-polyfill.min')
}

const data: typeof window['__NEXT_DATA__'] = JSON.parse(
document.getElementById('__NEXT_DATA__')!.textContent!
)
Expand Down
2 changes: 1 addition & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
"escape-string-regexp": "2.0.0",
"etag": "1.8.1",
"file-loader": "6.0.0",
"finally-polyfill": "0.1.0",
"finally-polyfill": "0.2.0",
"find-up": "4.1.0",
"fresh": "0.5.2",
"gzip-size": "5.1.1",
Expand Down

0 comments on commit 6926ab7

Please sign in to comment.