0.1.0 • Published 6 years ago

@zeit/next-preact v0.1.0

Weekly downloads
492
License
MIT
Repository
github
Last release
6 years ago

Next.js + preact

Use preact with Next.js

Installation

npm install --save @zeit/next-preact preact preact-compat

or

yarn add @zeit/next-preact preact preact-compat

Usage

Create a next.config.js in your project

// next.config.js
const withPreact = require('@zeit/next-preact')
module.exports = withPreact()

Then create a server.js

// server.js
require('@zeit/next-preact/alias')()
const { createServer } = require('http')
const next = require('next')


const app = next({ dev: process.env.NODE_ENV !== 'production' })
const port = process.env.PORT || 3000
const handle = app.getRequestHandler()

app.prepare()
.then(() => {
  createServer(handle)
  .listen(port, () => {
    console.log(`> Ready on http://localhost:${port}`)
  })
})

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

// next.config.js
const withPreact = require('@zeit/next-preact')
module.exports = withPreact({
  webpack(config, options) {
    return config
  }
})
0.1.1-canary.0

6 years ago

0.1.0

6 years ago

0.0.8-canary.1

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago