npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

next-inferno

v0.1.0

Published

next.js + Inferno

Downloads

4

Readme

Next.js + Inferno

Use Inferno :fire: with Next.js to get even faster :zap: rendering.

Installation

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

or

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

Usage

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
  }
})

TypeScript support

Looking for TypeScript support? Just follow that easy steps to use it in your Next projects:

  1. Install typescript and @zeit/next-typescript (aslo you can use next-awesome-typescript for perfomance reasons):
npm install --save typescript @zeit/next-typescript

or

yarn add typescript @zeit/next-typescript
  1. Edit next.config.js:
// next.config.js
const withInferno = require('next-inferno')
const withTypescript = require('@zeit/next-typescript')

module.exports = withInferno(withTypescript())
  1. Create 'tsconfig.json' file:
{
  "compileOnSave": false,
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "jsx": "preserve",
    "allowSyntheticDefaultImports": true,
    "allowJs": true,
    "moduleResolution": "node",
    "sourceMap": true,
    "removeComments": false,
    "baseUrl": ".",
    "lib": [
      "dom",
      "es2015",
      "es2016"
    ]
  }
}
  1. Write code :fire:

Check on compile

By default, next's TypeScript plugin only transpiles your code without type checks. It means that you can see type errors only in your IDE or code editor (for example VS Code can do it out of the box).

If you want to enable typechecks on compile to see type errors in terminal or browser, make the following changes in 'next.config.js':

// next.config.js
const withInferno = require('next-inferno')
const withTypescript = require('@zeit/next-typescript')

module.exports = withInferno(withTypescript({
  webpack(config, options) {
    return config
  },
  typescriptLoaderOptions: {
    transpileOnly: false
  }
}))