-
Notifications
You must be signed in to change notification settings - Fork 29.9k
Closed
Description
The framework accomplishes a very important milestone: server and client rendering with a single code base, which is great. However, while trying to create a custom <Document> I receive the following error:
Module not found: Error: Cannot resolve module 'next/document'
I just copy-pasted the sample code in the README file.
// ./pages/_document.js
import Document, { Head, Main, NextScript } from 'next/document'
export default class MyDocument extends Document {
static async getInitialProps (ctx) {
const props = await Document.getInitialProps(ctx)
return { ...props, customValue: 'hi there!' }
}
render () {
return (
<html>
<Head>
<style>{`body { margin: 0 } /* custom! */`}</style>
</Head>
<body className="custom_class">
{this.props.customValue}
<Main />
<NextScript />
</body>
</html>
)
}
}
Is next/document bundled with the framework or is this an optional module? Any ideas? The Link and the other components are working fine.
NPM version: 3.10.9
Node version: v6.9.2
Metadata
Metadata
Assignees
Labels
No labels