Let `webpack` do all the heavy lifting – the stats output is now just another object! The only downside is that the output is always relative to the configured webpack output folder.
Instead of using node's `fs` make use of webpack's `outputFileSystem`. This is useful when using `webpack-dev-server` or similar where assets are served out of memory instead of on-disk. This also means that the async family of file system functions need to be used.
Instead of using the `done` event, use 'after-emit' which is async – there are ups and downs to this. It means that when consumers are listening for the `done` event then the stats file is guaranteed to be available, but also that the generated stats object is (by default) missing some profiling information and timing. For the majority of people using this plugin to access the asset names this will not be a problem.
Use `mocha` and `chai` instead of `nodeunit` since `chai` has much better error reporting and it unfortunately doesn't seem to work well with `nodeunit`.
If the directory to your stats file doesn't yet exist, this plugin throws an error. Think it's nicer to create the directiry if needed before writing the stats file.