FullstackAcademy / boilermaker

Code scaffold for projects
https://www.youtube.com/watch?v=7bLSuTHH4Ag&list=PLx0iOsdUOUmn7D5XL4mRUftn8hvAJGs8H
MIT License
215 stars 706 forks source link

use webpack middleware to avoid stale bundles #204

Open collin opened 4 years ago

collin commented 4 years ago

Replaces the multi-process bundle approach with webpack-dev-middleware

This is a common annoyance for students and shows up as this sequence while debugging:

I've regularly stepped into Sr Phase help tickets where students were in this cycle and did not realize it, having wasted quite a bit of time and having lost a lot of confidence in their sanity.

Using webpack-dev-middleware would increase a delay and the cycle would go like this:

This PR includes an explanatory comment for students.

  //   This middleware will match requests to GET /bundle.js
  //   An advantage to using this middleware is if webpack is
  //   in the middle of a compilation the request will not
  //   return content until the fresh bundle is availble.
  //
  //   In production, the bundle will be generated and stored in the
  //   public/ directory.