Skip to content

Commit e01056d

Browse files
aranajhonnyrauchg
authored andcommitted
example using inferno v1.0.* (#663)
* example using inferno v1.0.* * fix name.
1 parent e38cacc commit e01056d

File tree

5 files changed

+68
-0
lines changed

5 files changed

+68
-0
lines changed

examples/using-inferno/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
# Hello World example
3+
4+
## How to use
5+
6+
Download the example (or clone the repo)[https://github.com/zeit/next.js.git]:
7+
8+
```bash
9+
curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/using-inferno
10+
cd using-inferno
11+
```
12+
13+
Install it and run:
14+
15+
```bash
16+
npm install
17+
npm run dev
18+
```
19+
20+
Deploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.co/download))
21+
22+
```bash
23+
now
24+
```
25+
26+
## The idea behind the example
27+
28+
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.
29+
30+
Here's how we did it:
31+
32+
* Use `next.config.js` to customize our webpack config to support [inferno-compat](https://www.npmjs.com/package/inferno-compat)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
webpack: function (config) {
3+
config.resolve.alias = {
4+
'react': 'inferno-compat',
5+
'react-dom': 'inferno-compat'
6+
}
7+
return config
8+
}
9+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "using-inferno",
3+
"version": "1.0.0",
4+
"scripts": {
5+
"dev": "next",
6+
"build": "next build",
7+
"start": "next start"
8+
},
9+
"dependencies": {
10+
"next": "^2.0.0-beta",
11+
"inferno": "^1.0.7",
12+
"inferno-compat": "^1.0.7"
13+
},
14+
"author": "",
15+
"license": "MIT"
16+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import React from 'react'
2+
3+
export default () => (
4+
<div>About us</div>
5+
)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import React from 'react'
2+
import Link from 'next/prefetch'
3+
4+
export default () => (
5+
<div>Hello World. <Link href='/about'>About</Link></div>
6+
)

0 commit comments

Comments
 (0)