Skip to content
This repository was archived by the owner on Aug 8, 2019. It is now read-only.
Nicholas Johnson edited this page Apr 12, 2016 · 30 revisions

Installation

Installation is via npm:

npm install webpack -g

Compiling JavaScript

Give Webpack an entry point and an output file:

webpack ./app.js app.bundle.js

Creating a JavaScript module

We can define modules in JavaScript using the CommonJS syntax, as for Node:

cats.js

var cats = ['dave', 'henry', 'martha'];
module.exports = cats;

app.js

cats = require('./cats.js');
console.log(cats);

FURTHER READING

Recommended reading: Webpack your bags by Maxime Fabre - a very good introduction on how to setup a real-world project using Webpack.

Clone this wiki locally