From e01056d3f1fe2b7007767dc270a165d83f0623d6 Mon Sep 17 00:00:00 2001 From: Arana Jhonny Date: Thu, 5 Jan 2017 13:26:01 -0400 Subject: [PATCH] example using inferno v1.0.* (#663) * example using inferno v1.0.* * fix name. --- examples/using-inferno/README.md | 32 +++++++++++++++++++++++++++ examples/using-inferno/next.config.js | 9 ++++++++ examples/using-inferno/package.json | 16 ++++++++++++++ examples/using-inferno/pages/about.js | 5 +++++ examples/using-inferno/pages/index.js | 6 +++++ 5 files changed, 68 insertions(+) create mode 100644 examples/using-inferno/README.md create mode 100644 examples/using-inferno/next.config.js create mode 100644 examples/using-inferno/package.json create mode 100644 examples/using-inferno/pages/about.js create mode 100644 examples/using-inferno/pages/index.js diff --git a/examples/using-inferno/README.md b/examples/using-inferno/README.md new file mode 100644 index 0000000000000..15d90eff41680 --- /dev/null +++ b/examples/using-inferno/README.md @@ -0,0 +1,32 @@ + +# 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 diff --git a/examples/using-inferno/next.config.js b/examples/using-inferno/next.config.js new file mode 100644 index 0000000000000..7137bc28a210c --- /dev/null +++ b/examples/using-inferno/next.config.js @@ -0,0 +1,9 @@ +module.exports = { + webpack: function (config) { + config.resolve.alias = { + 'react': 'inferno-compat', + 'react-dom': 'inferno-compat' + } + return config + } +} diff --git a/examples/using-inferno/package.json b/examples/using-inferno/package.json new file mode 100644 index 0000000000000..37ee7bfc1c0f1 --- /dev/null +++ b/examples/using-inferno/package.json @@ -0,0 +1,16 @@ +{ + "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" +} diff --git a/examples/using-inferno/pages/about.js b/examples/using-inferno/pages/about.js new file mode 100644 index 0000000000000..6c501fbd81e18 --- /dev/null +++ b/examples/using-inferno/pages/about.js @@ -0,0 +1,5 @@ +import React from 'react' + +export default () => ( +
About us
+) diff --git a/examples/using-inferno/pages/index.js b/examples/using-inferno/pages/index.js new file mode 100644 index 0000000000000..054ce84bdb075 --- /dev/null +++ b/examples/using-inferno/pages/index.js @@ -0,0 +1,6 @@ +import React from 'react' +import Link from 'next/prefetch' + +export default () => ( +
Hello World. About
+)