vigetlabs / blendid

A delicious blend of gulp tasks combined into a configurable asset pipeline and static site builder
MIT License
4.97k stars 683 forks source link

Prevent `browserSync.server.middleware` from being ovewritten completely #503

Closed maoueh closed 6 years ago

maoueh commented 6 years ago

Currently, the server.middleware config option is completely set in stone and there is no possibility to extend it. However, to be able to make React Router <BrowserRouter> (opposed to <HashRouter>) to work, one need to add a browserSync middleware.

To overcome the problem, two mecanisms has been added to solve this. First, if the browserSync.server.middleware is already defined, blendid does not try to override it anymore.

If not present, default middleware (webpack-dev-middleware) is used. Furthermore, the default mdidlewares from browserSync.server.middleware are concatenated with the ones find on config browserSync.server.extraMiddlewares (defaults to [] when none defined).

Fixed problem running on Node v8 (at least in development mode via yarn link) by updating require-dir to latest version (0.3.2).

maoueh commented 6 years ago

Seems github is not updating my PR as my branch now points to https://github.com/maoueh/blendid/commit/d4899655b7bcebce5282c6bae46c5aa3f6694776.

I will see later if it get updated otherwise I will close and open again.

maoueh commented 6 years ago

Seems it's GitHub catch up with my push finally. Ready for review.

greypants commented 6 years ago

Looks good! Will get someone to publish a new version shortly. cc @benjtinsley @leobauza @mzlock