For specifics, you can reference a guide I wrote on how to do this for webpack (http://bkaprt.com/rjs39/05-23), as well as a live coding demonstration (http://bkaprt.com/rjs39/05-24). I also have an example repository available (http://bkaprt.com/rjs39/05-252704-2709 ↱
Responsible JavaScript
Jeremy Wagner