forked from webpack/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
usage
Nicholas Johnson edited this page Apr 12, 2016
·
28 revisions
Installation is via npm:
npm install webpack -g
Give Webpack an entry point and an output file:
webpack ./app.js app.bundle.js
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);
Recommended reading: Webpack your bags by Maxime Fabre - a very good introduction on how to setup a real-world project using Webpack.
- see CLI for the command line interface.
- see node.js API for the node.js interface.
- see Configuration for the configuration options.