title: Node.js + Express server specific static files extremely slow
body: <p>I have this very weird problem.
  I'm running an Express (Node.js) server with a React front-end.
  Ever since I've began developing it, it has run cleanly and without issues, taking a few seconds to load every refresh.</p>
  
  <p>Today it started loading horribly - From 20 seconds to a full minute for a 2MB app.</p>
  
  <p>I checked and found that there are two files - <code>vendor.bundle.js</code> and <code>bundle.js</code> (Created by gulp and contain the app code and external dependencies) that take much more time to load than others.
  Each of them weighs about 700KB and takes about 10 seconds to load.
  As a comparison, <code>vendor.js</code> weighs about 400KB and takes 1 second to load.</p>
  
  <p>If that's not enough - I tried running the boilerplate for the app I'm using (It's an app from a tutorial so it weighs about the same) and it takes about 6 seconds to load.</p>
  
  <p>I have absolutely no idea why is this happening or why is there a difference with these specific files.</p>
  
  <p>Do you have any ideas? I've become quite desperate.</p>
  
  <p>Thanks for any help.</p>
  
  <p>Express static file serving and a bit of the sorrounding:</p>
  
  <pre><code>app.use(logger('dev'));
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({ extended: false }));
  
  //Static files being served
  app.use(express.static(path.join(__dirname, 'public')));
  
  app.use(require('./routes/user-routes'));
  
  app.all('/api/*', jwt_middleware({ secret: config.secret }).unless({path: ['/login']}));
  app.use(function (err, req, res, next) {
    if (err.name === 'UnauthorizedError') {
      res.status(401).send('invalid token...');
    }
  });
  
  app.get('*', function (request, response, next){
    response.sendFile(path.join(__dirname, 'public', 'index.html'))
  });
  </code></pre>