Remove buildManifest from renderPage response for Next.js 8.

This commit is contained in:
João Vieira
2019-02-11 15:03:09 +00:00
parent 363cdf403a
commit ca5bde36c3
3 changed files with 11 additions and 6 deletions

View File

@@ -2,10 +2,13 @@ import * as React from "react";
import { NextContext, NextComponentType } from ".";
import { DefaultQuery } from "./router";
/**
* Result from renderPage().
* https://github.com/zeit/next.js/blob/v8.0.0/packages/next/pages/_document.js#L18
*/
export interface RenderPageResponse {
buildManifest: Record<string, any>;
html?: string;
head?: Array<React.ReactElement<any>>;
head?: React.ReactNode;
}
export interface PageProps {

View File

@@ -1,4 +1,4 @@
// Type definitions for next 7.0
// Type definitions for next 8.0
// Project: https://github.com/zeit/next.js/packages/next
// Definitions by: Drew Hays <https://github.com/dru89>
// Brice BERNARD <https://github.com/brikou>

View File

@@ -48,7 +48,7 @@ class MyDoc extends Document<WithUrlProps> {
// with app and component enhancers
const enhanceApp: Enhancer<PageProps, {}> = App => props => <App />;
const enhanceComponent: Enhancer<PageProps, {}> = Component => props => <Component />;
const { html, head, buildManifest } = renderPage({
const { html, head } = renderPage({
enhanceApp,
enhanceComponent
});
@@ -60,7 +60,7 @@ class MyDoc extends Document<WithUrlProps> {
// Custom prop
const url = req!.url;
return { html, head, buildManifest, styles, url };
return { html, head, styles, url };
}
constructor(props: WithUrlProps & DocumentProps) {
@@ -73,12 +73,14 @@ class MyDoc extends Document<WithUrlProps> {
render() {
const { pathname, query } = this.props.__NEXT_DATA__;
const { head, styles } = this.props;
return (
<html>
<Head nonce="nonce" any="property" should="work" here>
{head}
<title>My page</title>
{this.props.styles}
{styles}
</Head>
<body>
<Main />