Skip to content

Commit df050da

Browse files
Update debugging instructions (#2422)
* Update debugging instructions Since webpack supports a --debug option and since we pass all additional args to webpack, we don't want to overload the --debug option. * Use instance Co-authored-by: Gaurav Tiwari <gauravtiwari@users.noreply.github.com>
1 parent 92a1fdc commit df050da

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

docs/troubleshooting.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44

55
1. Read the error message carefully. The error message will tell you the precise key value
66
that is not matching what Webpack expects.
7-
2. Put a `debugger` statement in your Webpack configuration and run `bin/webpack --debug`.
7+
2. Put a `debugger` statement in your Webpack configuration and run `bin/webpack --debug-webpacker`.
88
If you have a node debugger installed, you'll see the Chrome debugger for your webpack
99
config. For example, install the Chrome extension [NiM](https://chrome.google.com/webstore/detail/nodejs-v8-inspector-manag/gnhhdgbaldcilmgcpfddgdbkhjohddkj) and
1010
set the option for the dev tools to open automatically. For more details on debugging,
1111
see the official [Webpack docs on debugging](https://webpack.js.org/contribute/debugging/#devtools)
12+
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.
13+
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`
1214

1315
## ENOENT: no such file or directory - node-sass
1416

lib/webpacker/dev_server_runner.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@ def execute_cmd
5353
["yarn", "webpack-dev-server"]
5454
end
5555

56-
if ARGV.include?("--debug")
56+
if @argv.include?("--debug-webpacker")
5757
cmd = [ "node", "--inspect-brk"] + cmd
58-
ARGV.delete("--debug")
5958
end
6059

6160
cmd += ["--config", @webpack_config]

lib/webpacker/webpack_runner.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ def run
1313
["yarn", "webpack"]
1414
end
1515

16-
if ARGV.include?("--debug")
16+
if @argv.include?("--debug-webpacker")
1717
cmd = [ "node", "--inspect-brk"] + cmd
18-
ARGV.delete("--debug")
1918
end
2019

2120
cmd += ["--config", @webpack_config] + @argv

0 commit comments

Comments
 (0)