I'm just getting started with webpack and am having difficulty getting the multiple-entry-points sample to build. The webpack.config.js file in the example includes the line
var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin");
which fails for me with the error
Error: Cannot find module '../../lib/optimize/CommonsChunkPlugin'
Searching around, I found other examples of using the CommonsChunkPlugin with the expression
var commonsPlugin = new webpack.optimize.CommonsChunkPlugin("common.js");
which fails with the error
ReferenceError: webpack is not defined
Some more searching found a number of examples including
var webpack = require('webpack');
and my build now fails with
Error: Cannot find module 'webpack'
I'm at a loss as to how to proceed.
Link globally installed package to your project
npm link webpack