Skip to content

Commit

Permalink
Update debugging instructions (#2422)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
justin808 and gauravtiwari committed Aug 16, 2020
1 parent 92a1fdc commit df050da
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 3 additions & 1 deletion docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions lib/webpacker/dev_server_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 1 addition & 2 deletions lib/webpacker/webpack_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit df050da

Please sign in to comment.