Skip to content

Instantly share code, notes, and snippets.

@markerikson
Created November 3, 2016 00:04
Show Gist options
  • Save markerikson/f5f580d513b0619579ce435438f41308 to your computer and use it in GitHub Desktop.
Save markerikson/f5f580d513b0619579ce435438f41308 to your computer and use it in GitHub Desktop.
Webpack-Dev-Server summary

[7:53 PM] acemarke: webpack-dev-server is a dev server. Not an app server
[7:54 PM] acemarke: it's a compiler process
[7:54 PM] acemarke: more specifically, it's a small Express app that uses the webpack-dev-middleware and webpack-hot-middleware plugins
[7:55 PM] acemarke: it loads a Webpack config, creates a Webpack compiler instance, and passes that to webpack-dev-middleware
[7:55 PM] acemarke: WDM then passes an "in-memory filesystem" to the compiler, compiles your bundle into memory, and starts watching your source files on disk
[7:55 PM] acemarke: when the files change, it recompiles
[7:56 PM] acemarke: when a request for the bundle comes through Express, the middleware checks the request, sees that it matches the bundle name (or other output), and responds to the request with the in-memory file
[7:56 PM] acemarke: if you've got a backend app server, you can set up WDS to proxy other requests to that
[7:56 PM] acemarke: it's also entirely possible to write your own dev server using those middlewares
[7:56 PM] acemarke: which I did for my own app
[7:56 PM] acemarke: had some more specific proxying behavior I needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment