This plugin should only work when webpack is executed as a webpack-dev-server, https://github.com/gajus/write-file-webpack-plugin.
How do I detect within the plugin script whether the webpack is running a single build or a webpack-dev-server?
I have a very hacky workaround for this:
var IS_DEV_SERVER = process.argv[1].indexOf('webpack-dev-server') >= 0;
This will not work if webpack-dev-server is started programmatically.
Why would you need to detect this? You're programmatically starting the webpack dev server so you should know when it's being ran.
@gajus, do you need this also for webpack-dev-middleware users? If so, you could check compiler.outputFileSystem. See also this line.
@SpaceK33z thats what we are already doing
It feels a bit hacky though.
Otherwise, it works.
Whats about setting a simple environment variable?
Most helpful comment
Whats about setting a simple environment variable?