Saturday, January 19, 2019

node.js - Error: Cannot find module 'webpack'

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.

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...