title: Webpack optimization module concatenation: multi referenced from single entry bailout
body: <p>I am trying to wrap my head around module concatenation with Webpack 4.</p>
  
  <p>I have an entry.js script which uses imports from multiple modules which in turn import multiple modules.</p>
  
  <p>Using optimizationBailout warnings when bundeling throws following bailout warning.</p>
  
  <p>ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: multi ./public/js/entry.js (referenced with single entry)</p>
  
  <p>What does this bailout mean? How can I use module concatenation on the entry script?</p>
  
  <p>webpack.config.js looks as follows:</p>
  
  <pre><code>const path = require('path');
  
  module.exports = {
    entry: {
      xyz: ['./public/js/xyz_entry.js']
    },
    output: {
      path: path.resolve(__dirname, 'public/js/build'),
      filename: '[name]_bundle.js'
    },
    devtool: 'source-map',
    module: {
      rules: [{
        test: /\.js$/,
        exclude: /node_modules/
      }]
    },
    optimization: {
      concatenateModules: true
    },
    stats: {
      maxModules: Infinity,
      optimizationBailout: true
    }
  };
  </code></pre>
  
  <p>entry.js looks like this:</p>
  
  <pre><code>import token from './token';
  
  import hooks from './hooks';
  
  token(init);
  
  function init() {
  
    hooks();
  
  }
  </code></pre>
  
  <p>I import export in the modules like so (token.mjs):</p>
  
  <pre><code>import workspace from './workspace.mjs';
  
  export default next =&gt; { }
  </code></pre>
  
  <p>My dev dependencies in the package.json are:</p>
  
  <pre><code>  "devDependencies": {
      "webpack": "^4.19.1",
      "webpack-cli": "^3.1.0"
    }
  </code></pre>
  
  <p>I get following output on the build process:</p>
  
  <pre><code>dennis@dennis:~/Git/xyz$ npm run dev
  
  &gt; xyz@0.0.0 dev /home/dennis/Git/xyz
  &gt; webpack --mode development
  
  Hash: 6cfd1959ae17f9c8b13d
  Version: webpack 4.19.1
  Time: 233ms
  Built at: 2018-09-21 19:27:16
          Asset      Size  Chunks             Chunk Names
      xyz_bundle.js  14.2 KiB     xyz  [emitted]  xyz
  xyz_bundle.js.map  15.5 KiB     xyz  [emitted]  xyz
  Entrypoint xyz = xyz_bundle.js xyz_bundle.js.map
  [./public/js/xyz_entry.js] ./public/js/xyz_entry.js + 3 modules 9.68 KiB {xyz} [built]
      | ./public/js/xyz_entry.js 4.8 KiB [built]
      |     ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: multi ./public/js/xyz_entry.js (referenced with single entry)
      | ./public/js/token.mjs 2.26 KiB [built]
      | ./public/js/hooks.mjs 2.05 KiB [built]
      | ./public/js/workspace.mjs 579 bytes [built]
  [0] multi ./public/js/xyz_entry.js 28 bytes {xyz} [built]
      ModuleConcatenation bailout: Module is not an ECMAScript module
  </code></pre>