mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Add warning about module.exports use (#505)
* add warning about module.exports to readme * rm unnecessary react imports
This commit is contained in:
parent
b9f875318e
commit
200f8eecb2
23
README.md
23
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 = () => (
|
||||||
|
<Link href='/'>Invalid</Link>
|
||||||
|
)
|
||||||
|
```
|
||||||
|
##### Valid:
|
||||||
|
```js
|
||||||
|
// good import
|
||||||
|
import Link from 'next/link';
|
||||||
|
|
||||||
|
// good export
|
||||||
|
export default () => (
|
||||||
|
<Link href='/'>Valid</Link>
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
## Production deployment
|
## Production deployment
|
||||||
|
|
||||||
To deploy, instead of running `next`, you probably want to build ahead of time. Therefore, building and starting are separate commands:
|
To deploy, instead of running `next`, you probably want to build ahead of time. Therefore, building and starting are separate commands:
|
||||||
|
|
Loading…
Reference in a new issue