ModuleConcatenationPlugin bug

Do you want to request a feature or report a bug?

report a bug

What is the current behavior?

webpack.config:

var path = require('path')
var webpack = require('webpack')
module.exports = {
  entry: './entry.js',
  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'dist')
  },
  plugins: [
    new webpack.optimize.ModuleConcatenationPlugin()
  ]
}

package.json

{
  "name": "testwatch",
  "version": "1.0.0",
  "devDependencies": {
    "webpack": "^3.0.0"
  },
  "scripts": {
    "watch": "webpack --watch"
  }
}

I used webpack3 and opened ModuleConcatenationPlugin, and then run ‘webpack –watch’. After the compilation was successful, the webpack process exited and did not continue listening. Then I found that if I used the import statement in the JS file, the introduction of other modules would lead to this problem. I commented out all the ‘import’ statements and the monitor mode was running properly.

result:

result

Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.

macOs 10.12.4
node 6.10.2
npm 3.10.10
webpack 3.0.0

Author: Fantashit

1 thought on “ModuleConcatenationPlugin bug

  1. I discovered what is causing this issue while working on mzgoddard/hard-source-webpack-plugin#142. ModuleConcatenationPlugin removes the concatenated modules from compilation.modules and takes over the modules dependencies and reasons but doesn’t retain the fileDependencies and contextDependencies. Compilation summarizes fileDependencies and contextDependencies from all of the objects in compilation.modules. If ConcatenatedModule contains all of the modules originally in compilation.modules but none of the fileDependencies or contextDependencies the Compiler has no paths to give the file watcher and having no outstanding events (which there normally would be as the watcher would have some paths to watch) the node process process gracefully exits.

    ConcatenatedModule probably needs to mirror other Module types and have fileDependencies and contextDependencies. In its case those arrays should be a list of unique paths for the fileDependencies and contextDependencies of the modules ConcatenatedModule contains.

Comments are closed.