Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow dev runner to behave like the main runner #1672

Closed
wants to merge 1 commit into from
Closed

allow dev runner to behave like the main runner #1672

wants to merge 1 commit into from

Conversation

everplays
Copy link

We allowed the use of ARGS in Webpacker::WebpackRunner to pass
down any necessary arguments to webpack itself:

cmd = [ "#{@node_modules_path}/.bin/webpack", "--config", @webpack_config ] + @argv

However, this was not the case for Webpacker::DevServerRunner. Hence,
it was not possible to run the dev runner as such:

./bin/webpack-dev-server --inline=false

This is depite the fact that ARGS are passed to DevServerRunner.

We allowed the use of ARGS in `Webpacker::WebpackRunner` to pass
down any necessary arguments to webpack itself:

```ruby
cmd = [ "#{@node_modules_path}/.bin/webpack", "--config", @webpack_config ] + @argv
```

However, this was not the case for `Webpacker::DevServerRunner`. Hence,
it was not possible to run the dev runner as such:

```bash
./bin/webpack-dev-server --inline=false
```

This is depite the fact that ARGS are passed to DevServerRunner.
@everplays everplays changed the title allow dev runner to behave like main runner allow dev runner to behave like the main runner Aug 28, 2018
@gauravtiwari
Copy link
Member

Thanks, @everplays for the PR.

The reason for this is that we don't have support for overriding dev server options through ARGS. There are some middlewares that work with dev server and therefore, it's tricky to make things work with multiple configuration sources.

You can pass options through webpacker.yml or an environment variable.

WEBPACKER_DEV_SERVER_HOST=example.com WEBPACKER_DEV_SERVER_INLINE=true WEBPACKER_DEV_SERVER_HOT=false ./bin/webpack-dev-server

https://github.com/rails/webpacker/blob/master/lib/webpacker/dev_server_proxy.rb

@everplays
Copy link
Author

So it's not implemented to prevent the developers from shooting themselves in the foot.

In my case, changing the webpacker.yml is not desired because I am the only one in our team who wants to disable the inline. Anyway, even though dealing with arguments would be easier for something like --inline=false, the modification via env variable works for me.

Thanks for the reply @gauravtiwari and feel free to do as you please with this PR. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants