1.0.3 • Published 8 years ago

webpack-for-dummies v1.0.3

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

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

OptionRequiredDefaultDescription
inputyesNAThe string path to the input (or entry) file
outputyesNAThe string path to the output file
hotnotrueEnable hot module reloading on the Webpack dev server
portno4000The int port number of the Webpack dev server
cleannofalseClean (destroy and re-create) the output directory
targetnoNA'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.