How to make custom configurations

In a nutshell, all Next.js configurations are done via next.config.js. With Next.js 5, this became even easier.

Let's create an empty project for experiments:

$ npm init$ npm install react react-dom

Let's add SASS support as an example:

$ npm install next node-sass @zeit/next-sass --save-dev

Enhance the scripts section of package.json:

// package.json{    "scripts": {        "start": "next"    }}

Next, we again have to create a custom document (the same as before):

// pages/_document.jsimport Document, {Head, Main, NextScript} from 'next/document';export default class MyDocument extends Document {    render() {        return (            <html>            <Head>                <title>NextJS Condensed</title> <link rel="stylesheet" href="/_next/static/style.css"/> ...

Get Next.js Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.