Webpack config with multiple entries and a global site wide entry
<p>I'm moving from requirejs to webpack.
In my require js setup, I have a site-wide file <code>site.js</code> that does some global setup, and non-page-specific stuff, like ajax prefilters, some global ui component setup, etc.</p>

<p>Some pages have self contained js apps specifically for a given page, where I'd have <code>window.appPaths = ['some/path/to/app.js']</code> set in the template, and <code>site.js</code> would load up the app once the initial site wide stuff was done.</p>

<p>However, moving to webpack, it's reading my <code>require(window.appPaths)</code> and then it converts it to some regex and attempts to bundle every single js file in my src directory.</p>

<p>So basically, I'm wondering if there's a way for me to set this up to have multiple entry points, one being something like <code>site.js</code> and another being something like <code>somePageApp.js</code> wherein <code>site.js</code> is actually a dependency of the latter, but the latter doesn't <em>always</em> exist.</p>

<p>Sigh, hopefully that's clear, i'll elaborate where necessary.</p>

<hr>

<p>edit: This is how it was set up in require.js setup, my output was:</p>

<p>html for an app page:</p>

<pre><code>&lt;script src="site.js"&gt;
&lt;script&gt;
  window.appPaths = ['someApp.js'];
&lt;/script&gt;
</code></pre>

<p>site.js:</p>

<pre><code>require([
  // deps for sitewide stuff
], function () {

  // doing global general stuff

  someTask(function () {
    if(window.appPaths) require(window.appPaths)
  })
})
</code></pre>

<p>someApp.js:</p>

<pre><code>require([
  // app specific deps
], function () {
  // application code that doesn't run because not `require`d until the site.js tasks are done.
})
</code></pre>

<p>My "ideal" setup isn't necessarily the exact same, but I would want <code>someApp.js</code> to not load and/or run until site.js loaded. In my requirejs setup, site.js was also essentially the commons chunk but I don't think that's necessary here... just having trouble finding a parallel style of organization in webpack...</p>