title: Create React App V2 - Multiple entry points
body: <p>I'm trying to build a React app with 2 entry points, one for the App and one for the Admin panel.</p>
  
  <p>I'm starting with Create React App V2 and following this gitHub issue thread <a href="https://github.com/facebook/create-react-app/issues/1084" rel="noreferrer">https://github.com/facebook/create-react-app/issues/1084</a> and this tutorial <a href="http://imshuai.com/create-react-app-multiple-entry-points/" rel="noreferrer">http://imshuai.com/create-react-app-multiple-entry-points/</a>.</p>
  
  <p>I'm trying to port the instructions for adding multiple entry points from CRA V1 to work in V2 but I think I am missing something.</p>
  
  <p>After ejecting CRA, these are the paths I've changed/added to paths.js:</p>
  
  <pre><code>module.exports = {
      appBuild: resolveApp('build/app'),
      appPublic: resolveApp('public/app'),
      appHtml: resolveApp('public/app/index.html'),
      appIndexJs: resolveModule(resolveApp, 'src/app'),
      appSrc: resolveApp('src'),
      adminIndexJs: resolveModule(resolveApp, 'src/admin'),
      adminSrc: resolveApp('src'),
      adminPublic: resolveApp('public/admin'),
      adminHtml: resolveApp('public/admin/index.html'),
  };
  </code></pre>
  
  <p>I've added these entry points to webpack:</p>
  
  <pre><code>    entry: {
          app: [
              isEnvDevelopment &amp;&amp;
                  require.resolve('react-dev-utils/webpackHotDevClient'),
              paths.appIndexJs,
          ].filter(Boolean),
          admin: [
              isEnvDevelopment &amp;&amp;
                  require.resolve('react-dev-utils/webpackHotDevClient'),
              paths.adminIndexJs,
          ].filter(Boolean)
      },
      output: {
        path: isEnvProduction ? paths.appBuild : undefined,
        pathinfo: isEnvDevelopment,
        filename: isEnvProduction
          ? 'static/js/[name].[contenthash:8].js'
          : isEnvDevelopment &amp;&amp; 'static/js/bundle.js',
        chunkFilename: isEnvProduction
          ? 'static/js/[name].[contenthash:8].chunk.js'
          : isEnvDevelopment &amp;&amp; 'static/js/[name].chunk.js',
        publicPath: publicPath,
        devtoolModuleFilenameTemplate: isEnvProduction
          ? info =&gt;
              path
                .relative(paths.appSrc, info.absoluteResourcePath)
                .replace(/\\/g, '/')
          : isEnvDevelopment &amp;&amp;
            (info =&gt; path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')),
      },
  </code></pre>
  
  <p>I've modified HtmlWebpackPlugin like so:</p>
  
  <pre><code>  new HtmlWebpackPlugin(
      Object.assign(
        {},
        {
          inject: true,
          template: paths.appHtml,
          filename: paths.appPublic,
        },
        isEnvProduction
          ? {
              minify: {
                removeComments: true,
                collapseWhitespace: true,
                removeRedundantAttributes: true,
                useShortDoctype: true,
                removeEmptyAttributes: true,
                removeStyleLinkTypeAttributes: true,
                keepClosingSlash: true,
                minifyJS: true,
                minifyCSS: true,
                minifyURLs: true,
              },
            }
          : undefined
      )
    ),
    new HtmlWebpackPlugin(
      Object.assign(
        {},
        {
          inject: true,
          template: paths.adminHtml,
          filename: paths.adminPublic,
        },
        isEnvProduction
          ? {
              minify: {
                removeComments: true,
                collapseWhitespace: true,
                removeRedundantAttributes: true,
                useShortDoctype: true,
                removeEmptyAttributes: true,
                removeStyleLinkTypeAttributes: true,
                keepClosingSlash: true,
                minifyJS: true,
                minifyCSS: true,
                minifyURLs: true,
              },
            }
          : undefined
      )
    ),
  </code></pre>
  
  <p>And modified webpack Dev Server:</p>
  
  <pre><code>historyApiFallback: {
    disableDotRule: true,
    rewrites: [
      { from: /^\/admin.html/, to: '/build/admin/index.html' },
    ]
  },
  </code></pre>
  
  <p>My file structure is like follows:</p>
  
  <pre><code>.
  +-- _src
  |   +-- app.js
  |   +-- admin.js
  |   +-- _app
  |       +-- App.js
  |   +-- _admin
  |       +-- App.js
  |   +-- _shared
  |       +-- serviceWorker.js
  +-- _public
  |   +-- _app
  |       +-- index.html
  |       +-- manifest.json
  |   +-- _admin
  |       +-- index.html
  |       +-- manifest.json
  </code></pre>
  
  <p>I would like my build folder to contain an app folder and an admin folder with the 2 separate SPA's in them.</p>
  
  <p>When I run <code>yarn start</code> it doesn't throw any errors and says <code>Compiled successfully!</code> however its only partially compiled the app and not the admin app, no js has been compiled or added to the app either.</p>
  
  <p><code>yarn build</code> does throw an error and a half compiled app, no admin app. This is the error:</p>
  
  <pre><code>yarn run v1.12.3
  $ node scripts/build.js
  Creating an optimized production build...
  Failed to compile.
  
  EISDIR: illegal operation on a directory, open 
  'foo/bar/public/app'
  
  
  error Command failed with exit code 1.
  info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
  </code></pre>
  
  <p>In the build folder it had created much this before it exit:</p>
  
  <pre><code>.
  +-- _static
  |   +-- _css
  |   +-- _js
  |   +-- _media
  |       +-- logo.5d5d9eef.svg
  +-- precache-manifest.a9c066d088142837bfe429bd3779ebfa.js
  +-- service-worker.js
  +-- asset-manifest.json
  +-- manifest.json
  </code></pre>
  
  <p>Does anyone know what I am missing out to make this work correctly?</p>