提交 e01056d3 编写于 作者: A Arana Jhonny 提交者: Guillermo Rauch

example using inferno v1.0.* (#663)

* example using inferno v1.0.*

* fix name.
上级 e38cacc4
# Hello World example
## How to use
Download the example (or clone the repo)[https://github.com/zeit/next.js.git]:
```bash
curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/using-inferno
cd using-inferno
```
Install it and run:
```bash
npm install
npm run dev
```
Deploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.co/download))
```bash
now
```
## The idea behind the example
This example uses [Inferno](https://github.com/infernojs/inferno), an insanely fast, 9kb React-like library for building high-performance user interfaces on both the client and server. Here we've customized Next.js to use Inferno instead of React.
Here's how we did it:
* Use `next.config.js` to customize our webpack config to support [inferno-compat](https://www.npmjs.com/package/inferno-compat)
\ No newline at end of file
module.exports = {
webpack: function (config) {
config.resolve.alias = {
'react': 'inferno-compat',
'react-dom': 'inferno-compat'
}
return config
}
}
{
"name": "using-inferno",
"version": "1.0.0",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "^2.0.0-beta",
"inferno": "^1.0.7",
"inferno-compat": "^1.0.7"
},
"author": "",
"license": "MIT"
}
import React from 'react'
export default () => (
<div>About us</div>
)
import React from 'react'
import Link from 'next/prefetch'
export default () => (
<div>Hello World. <Link href='/about'>About</Link></div>
)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册