I am using webpack 1.14.0 and I am having problems with the fact that CommonsChunkPlugin works as I expect.
I have a configuration file similar to this (I simplified it):
var webpack = require('webpack'); module.exports = { context : __dirname, output: { filename: "[name].dist-[chunkhash].js", chunkFilename: "chunk.[id]-[chunkhash].js", path: 'js/min', publicPath: '/js/min/', pathinfo: true }, // Entry points for the application entry : { "homepage": "/a/b/homepage.js", "contact": "/a/b/contact.js", "list": "/a/b/list.js" }, resolve: { packageAlias: false, alias: { "jquery": "/a/b/jquery", "dependency-1": "/a/b/dependency-1", "dependency-2": "/a/b/dependency-2" } }, plugins: [ new webpack.optimize.CommonsChunkPlugin({ name: "commons", filename:"commons.js", minChunks: 3 }) ] };
As I understand it, CommonsChunkPlugin will analyze entry points and other resulting chunk files, look for duplicated modules and put them in a new "commons" block.
I am following these examples and cannot get anything but the commons.js file without any modules inside.
All I get is:
- Collection
entry points . - A lot of
chunk files (depending on entry points, as I understand it) - a
common.js , which contains only the implementation of webpack methods.
This leads me to the following question: Do I understand the purpose of CommonsChunkPlugin correctly?
Does it analyze only entry points and omits pieces? 90% of my modules are defined in AMD , does this affect my results?
source share