1. @webpack-blocks/dev-server
Webpack block for the webpack dev server.
@webpack-blocks/dev-server
Package: @webpack-blocks/dev-server
Created by: andywer
Last modified: Mon, 13 Jun 2022 01:37:35 GMT
Version: 2.1.0
License: MIT
Downloads: 1,136
Repository: https://github.com/andywer/webpack-blocks

Install

npm install @webpack-blocks/dev-server
yarn add @webpack-blocks/dev-server

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.

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code