next-inferno-typescript

0.0.3 • Public • Published

Next.js + Inferno + TypeScript

Use Inferno 🔥 with Next.js and TypeScript to get even faster ⚡️ rendering.

Installation

npm install --save next-inferno-typescript inferno inferno-compat inferno-clone-vnode inferno-create-class inferno-create-element

or

yarn add next-inferno-typescript inferno inferno-compat inferno-clone-vnode inferno-create-class inferno-create-element

Usage

@TODO

Create a next.config.js in your project

// next.config.js
const withInferno = require('next-inferno')
module.exports = withInferno()

Then create a server.js

// server.js
require('next-inferno/alias')()
const { createServer } = require('http')
const next = require('next')
 
const app = next({ dev: process.env.NODE_ENV !== 'production' })
const handle = app.getRequestHandler()
const port = process.env.PORT || 3000
 
app.prepare()
.then(() => {
  createServer(handle)
  .listen(port, () => {
    console.log(`> Ready on http://localhost:${port}`)
  })
})

Then add or change "scripts" section of your package.json:

...
"scripts"{
  "dev": "node server.js",
  "build": "next build",
  "start": "NODE_ENV=production node server.js"
},
...

Optionally you can add your custom Next.js configuration as parameter

// next.config.js
const withInferno = require('next-inferno')
module.exports = withInferno({
  webpack(config, options) {
    return config
  }
})

Package Sidebar

Install

npm i next-inferno-typescript

Weekly Downloads

1

Version

0.0.3

License

MIT

Unpacked Size

29.1 kB

Total Files

5

Last publish

Collaborators

  • queses