@webpack-blocks/dev-server
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/webpack-blocks__dev-server package

2.1.0 • Public • Published

webpack-blocks - Webpack Dev Server

Gitter chat NPM Version

This is the dev-server block providing webpack dev server configuration.

Usage

const { createConfig, env } = require('@webpack-blocks/webpack')
const devServer = require('@webpack-blocks/dev-server')

module.exports = createConfig([
  // use only if `NODE_ENV === 'development'`:
  env('development', [
    devServer({
      // Show full-screen overlay in the browser on compiler errors or warnings
      overlay: true,

      // If you need to proxy API requests:
      proxy: {
        '/api': { target: 'http://localhost:3000' }
      }
    })
  ])
])

Don’t forget to enable hot reload in your app. If you’re using React it may look like this:

import React from 'react'
import ReactDOM from 'react-dom'

function render() {
  ReactDOM.render(<h1>Hello, webpack-blocks!</h1>, document.getElementById('root'))
}

render()

if (module.hot) {
  module.hot.accept(render)
}

webpack-blocks

Check out the

👉 Main documentation

Released under the terms of the MIT license.

Readme

Keywords

Package Sidebar

Install

npm i @webpack-blocks/dev-server

Weekly Downloads

310

Version

2.1.0

License

MIT

Unpacked Size

6.16 kB

Total Files

5

Last publish

Collaborators

  • andywer
  • webpack-blocks-andy