diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 23613c88c..b307de7ac 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -4,11 +4,13 @@ 1. Read the error message carefully. The error message will tell you the precise key value that is not matching what Webpack expects. -2. Put a `debugger` statement in your Webpack configuration and run `bin/webpack --debug`. +2. Put a `debugger` statement in your Webpack configuration and run `bin/webpack --debug-webpacker`. If you have a node debugger installed, you'll see the Chrome debugger for your webpack config. For example, install the Chrome extension [NiM](https://chrome.google.com/webstore/detail/nodejs-v8-inspector-manag/gnhhdgbaldcilmgcpfddgdbkhjohddkj) and set the option for the dev tools to open automatically. For more details on debugging, see the official [Webpack docs on debugging](https://webpack.js.org/contribute/debugging/#devtools) +3. Any arguments that you add to bin/webpack get sent to webpack. For example, you can pass `--debug` to switch loaders to debug mode. See [webpack CLI debug options](https://webpack.js.org/api/cli/#debug-options) for more information on the available options. +4. You can also pass additional options to the command to run the webpack-dev-server and start the webpack-dev-server with the option `--debug-webpacker` ## ENOENT: no such file or directory - node-sass diff --git a/lib/webpacker/dev_server_runner.rb b/lib/webpacker/dev_server_runner.rb index b0a7228d4..df88f1c36 100644 --- a/lib/webpacker/dev_server_runner.rb +++ b/lib/webpacker/dev_server_runner.rb @@ -53,9 +53,8 @@ def execute_cmd ["yarn", "webpack-dev-server"] end - if ARGV.include?("--debug") + if @argv.include?("--debug-webpacker") cmd = [ "node", "--inspect-brk"] + cmd - ARGV.delete("--debug") end cmd += ["--config", @webpack_config] diff --git a/lib/webpacker/webpack_runner.rb b/lib/webpacker/webpack_runner.rb index 0c26cec65..c0e560802 100644 --- a/lib/webpacker/webpack_runner.rb +++ b/lib/webpacker/webpack_runner.rb @@ -13,9 +13,8 @@ def run ["yarn", "webpack"] end - if ARGV.include?("--debug") + if @argv.include?("--debug-webpacker") cmd = [ "node", "--inspect-brk"] + cmd - ARGV.delete("--debug") end cmd += ["--config", @webpack_config] + @argv