2.0.1 • Published 5 years ago

koa-wdm v2.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

koa-webpack-dev-middleware

A development middleware for koa2.x with typescript for use with webpack bundles.

Requirements

This module requires a minimum of Node v10.16.3 and Webpack v4.41.0, and must be used with a server that accepts koa2.x-style middleware.

Get started

First thing's first, install the module.

npm:

npm install --save-dev koa-wdm

yarn:

yarn add -D koa-wdm

Usage

import Koa from 'koa'
import webpack from 'webpack'

import webpackConfig from './webpack.config'
import getMiddleware from '../src/index'

const app = new Koa()

const compiler = webpack(webpackConfig)

app.use(getMiddleware(compiler))

app.listen(8080, () => {
  console.log('start at 8080')
})

Options

The middleware accept a object to change some behavior. It also support zero config.

index

The index path for web server, defaults to "index.html".

Type: string
Default: index.html

log

In the rare event that a user would like to provide a custom logging interface, this property allows the user to assign one. Created with ansi-colors

Type: Out(An object consist of 5 function attributes, log, info, debug, warn, error)
Default: Logger

displayStats

It controller if ouput the log message.

Type: boolean
Default: true

stats

Options for formatting statistics displayed during and after compile. For more information and property details, please see the webpack documentation.

Type: boolean
Default:

{
  context: process.cwd(),
  colors: true,
}

License

MIT

2.0.1

5 years ago

2.0.0

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago