title: How to import a default export of webpack entry file from outside?
body: <p>I think I can best explain it with code. I have a file in webpack like the following:</p>
  
  <pre><code>import ReactDOMServer from 'react-dom/server';
  
  import Server from './server';
  
  import templateFn from './template';
  
  export default (req, res) =&gt; {
      const reactString = ReactDOMServer.renderToString(&lt;Server /&gt;);
      const template = templateFn(html);
      res.send(template);
  };
  </code></pre>
  
  <p>I also have an express application where I want to have access to the default exported function. If it makes any difference, this file is the webpack entry file. Here is what I tried in my express app:</p>
  
  <pre><code>const handleRequest = require(path.resolve(webpackConfig.output.path, webpackConfig.output.filename));
  
  app.get('*', (req, res) =&gt; {
      console.log(handleRequest);
  });
  </code></pre>
  
  <p>I was trying to import the webpack generated file with the hope that I will be able to access the entry file's default export. Well, I was wrong as the output of the import was <code>{}</code>. </p>
  
  <p>Is there a webpack plugin or some kind of a technique to do what I am trying to build? I don't want the express application to be part of the webpack build. That was the main reason I separated the code in this way. </p>