From 200f8eecb20a80dc5413a3ca29b52720b435e5ca Mon Sep 17 00:00:00 2001 From: James O'Dwyer Date: Fri, 23 Dec 2016 23:23:08 -0500 Subject: [PATCH] Add warning about module.exports use (#505) * add warning about module.exports to readme * rm unnecessary react imports --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index fb4fe0d8d6..e64b550f36 100644 --- a/README.md +++ b/README.md @@ -477,6 +477,29 @@ module.exports = { } ``` +#### Default Babel configuration +Next.js uses Babel6 out of the box, which doesn't support default `module.exports`. +##### Invalid: +```js +// bad import +const Link = require('next/link').default; + +// bad export +module.exports = () => ( + Invalid +) +``` +##### Valid: +```js +// good import +import Link from 'next/link'; + +// good export +export default () => ( + Valid +) +``` + ## Production deployment To deploy, instead of running `next`, you probably want to build ahead of time. Therefore, building and starting are separate commands: -- GitLab