koa-wdm
Webpack dev middleware for koa2.x with typescript.
Last updated 22 days ago by tqma .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install koa-wdm 
SYNC missed versions from official npm registry.

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

Current Tags

  • 2.0.1                                ...           latest (22 days ago)

7 Versions

  • 2.0.1                                ...           22 days ago
  • 2.0.0                                ...           a month ago
  • 1.0.4                                ...           a month ago
  • 1.0.3                                ...           a month ago
  • 1.0.2                                ...           a month ago
  • 1.0.1                                ...           a month ago
  • 1.0.0                                ...           a month ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 95
Dependencies (4)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |