2.0.0 • Published 8 years ago

@unfold/webpack-serve v2.0.0

Weekly downloads
74
License
ISC
Repository
github
Last release
8 years ago

Webpack Serve

Takes your webpack config and creates a development server with hot module reloading and error overlay. Built to resemble the experience you get from create-react-app.

Install

npm install --save-dev @unfold/webpack-serve

Usage

In the terminal

Either run $(npm bin)/webpack-serve at the root of your project, or add a "serve": "webpack-serve", to your package.json scripts. All arguments given are passed over to the webpack CLI.

With own express/connect backend

You can import and configure it with your own middleware or server.

import webpackServe from '@unfold/webpack-serve'
import config from '../webpack.config'
import server from './server'

webpackServe(config, {
  server,
  port: 5050,
})

Options

namedescriptiondefault value
portPort used for server8080
hostnameUsed by webpack and when opening the application in the browser on startlocalhost
contentBaseWhich folder to serve static content from/public
httpsServes content with SSLfalse

Pass them to webpackServe(config, { ...options }) or use PORT=5000 HTTPS=true webpack-serve in the terminal.

Quick example

mkdir my-app && cd my-app
echo "alert('🤓')" > index.js
mkdir public && echo "<script src=build.js></script>" > public/index.html
npm install @unfold/webpack-serve
$(npm bin)/webpack-serve index.js build.js

Copy the above code and run it in your terminal and you'll have a new app up and running. When you want to add webpack loaders or similar, use the webpack CLI options or add a webpack.config.js file.

Example screenshots from console and error overlay

screenshot showing compiled successfully screenshot showing warnings screenshot showing error screenshot showing error overlay

Credits

This project is using multiple utilities from react-dev-utils and the console look is shamelessly copied from the create-react-app console.

2.0.0

8 years ago

1.1.2

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.7.1

9 years ago

0.7.0

9 years ago

0.6.0

9 years ago

0.5.0

9 years ago

0.4.2

9 years ago

0.4.1

10 years ago

0.4.0

10 years ago

0.3.0

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago