jetpack-serve

3.1.0 • Public • Published

jetpack-serve

This is an express middleware for serving up bundles created by jetpack.

Use this in your app if you don't want to install/require the entire jetpack bundler in your production app.

Usage

Once the app is bundled:

$ jetpack build

You can serve it in your express application:

const express = require('express')
const jetpack = require('jetpack-serve')

const app = express()

app.get('/api/data', (req, res) => {
  res.send('hello')
})

app.use(jetpack())

app.listen(3000, function() {
  console.log('Running server on http://localhost:3000')
})

Options

Jetpack takes the following options:

  • dist - default: "dist"
  • env - default: the value of process.env.NODE_ENV, set to "production" to serve built bundle from dist

This package handles jetpack's differential builds! That is a modern or legacy bundle will be served based on the user agent of the browser.

Readme

Keywords

none

Package Sidebar

Install

npm i jetpack-serve

Weekly Downloads

1

Version

3.1.0

License

ISC

Unpacked Size

4.52 kB

Total Files

5

Last publish

Collaborators

  • kidkarolis