This is a duplicate of issue #1712 on webpack-dev-server, it was requested that I post it here :)
System:
OS: macOS 10.14.3
CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
Binaries:
Node: 8.10.0 - ~/.nvm/versions/node/v8.10.0/bin/node
Yarn: 1.9.4 - /usr/local/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v8.10.0/bin/npm
Browsers:
Chrome: 72.0.3626.121
Firefox: 65.0.1
Safari: 12.0.3
Would be really useful to be able to do:
module.exports = {
//...
devServer: {
stdin: true
}
};
instead of having to run webpack-dev-server with --stdin on CLI only as specified in the docs
Some popular dev tools (like vue-cli) have opinionated wrappers around webpack-dev-server that make it only possible to configure webpack via their own config files (where they pass along options to webpack-dev-server's devServer configuration object).
Unfortunately, this obscures really useful flags like stdin
Thank you for the amazing software!
I miss something. What's the purpose of this option? What do you want to achieve?
Right now, the only way to tell webpack-dev-server to shut down when stdin ends is by passing in the --stdin flag via CLI.
Some tools, such as Vue CLI, create wrappers around webpack-dev-server, and can only pass options to the devServer object in webpack.config. This means in a Vue CLI-generated project, we can't pass --stdin to webpack-dev-server because we aren't using the webpack-dev-server CLI
If we could declare this stdin behavior in devServer{} in webpack.config, it would make it easier to manage webpack-dev-server in environments that expect a process to stop when stdin closes
I have run into this specifically in an Elixir on Phoenix application, which in development spins up a webpack-dev-server wrapped by VueCLI that it expects to close when its stdin stream ends
@evilebottnawi will have to decide this
/cc @Loonride @hiroppy What do you think about this?
This issue had no activity for at least half a year.
It's subject to automatic issue closing if there is no activity in the next 15 days.
@evilebottnawi Any update on this one?
Feel free to send a PR
Now with serve integration, I think webpack serve --stdin should work.
I think we should postpone it, need think about it deeply
I want to close it, because stdin is CLI option, and should not supported by configuration
We should support --stdin option out of box, open stdin - start process, close stdin - close process
Yes, the same logic
Fixed in master (https://github.com/webpack/webpack-cli/pull/2259/), please use --watch-options-stdin instead of --stdin or --watch-stdin, serve still supported --stdin, but it is deprecated and will be removed in webpack-dev-server@4 in favor --watch-options-stdin, i.e. all commands for running webpack support --watch-options-stdin
Most helpful comment
Feel free to send a PR