Webpack Setup

This post describes how to get Webpack up and running, starting with a clean empty project. In addition we’ll explore how to get basic minification, linting and installation of other must have modules to get you started. For more in depth understanding, I recommend you follow the official Webpack starter guide.

Setup folder structure

  1. Create two folders — src and a dist.
    $ cd ~/Sites/app
    $ mkdir src
    $ mkdir dist
  2. Init package.json or manually create it following package-sample.json below.
    $ npm init
  3. Configure the entry points in webpack.config.js to ensure its pointing to the correct main files of your app.
    --> entry: ['./javascript/app/app.js', './scss/envmon.scss']

Appendix

Example webpack.config.js file

Example PACKAGE.json file