node package manager
Stop wasting time. Easily manage code sharing in your team. Create a free org »

webpack-for-dummies

Webpack for Dummies

Webpack is amazing, however setting up a complex Webpack configuration can often be a pain (ref).

This project's goal is to get you up and running with Webpack as quickly and as painlessly as possible by implementing sensible defaults. Webpack for dummies assumes you are trying to implement Webpack on a React project that uses JSX and ES6, and that you likely want to take advantage of Webpack's fantastic hot module replacement.

Getting started

  1. Install Webpack for Dummies via NPM:
npm install webpack-for-dummies
  1. Require Webpack for Dummies in your project:
var WebpackForDummies = require('webpack-for-dummies');
  1. Create a new instance of Webpack for Dummies:
var webpackForDummies = new WebpackForDummies({
  configurationOptions...
});
  1. Generate a Webpack configuration object:
webpackForDummies.generateConfig();

Configuration Options

Option Required Default Description
input yes NA The string path to the input (or entry) file
output yes NA The string path to the output file
hot no true Enable hot module reloading on the Webpack dev server
port no 4000 The int port number of the Webpack dev server
clean no false Clean (destroy and re-create) the output directory
target no NA 'node' will compile output for a node environment

Methods

generateConfig(): Returns a Webpack configuration object based on the configuration options Webpack for Dummies was initialized with.

startDevServer(): Starts a Webpack dev server based on the configuration options Wepback for Dummies was initialized with.