Add option --inspect dev-server
See original GitHub issueWhen you run yarn rw dev we launch two processes:
- webpack dev server
- redwood dev server
yarn rw dev
yarn run v1.22.4
$ /Users/peterp/x/redwoodjs/example-invoice/node_modules/.bin/rw dev
$ /Users/peterp/x/redwoodjs/example-invoice/node_modules/.bin/dev-server
$ /Users/peterp/x/redwoodjs/example-invoice/node_modules/.bin/webpack-dev-server --config ../node_modules/@redwoodjs/core/config/webpack.development.js
I would like to have the ability to pass --inspect in the dev-server: yarn rw dev api --inspect
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:9 (5 by maintainers)
Top Results From Across the Web
DevServer - webpack
This set of options is picked up by webpack-dev-server and can be used to ... Make sure that script references are added into...
Read more >webpack-dev-server
There is also the option to add a reference to the webpack-dev-server ... The function can inspect the HTTP request, response, and any...
Read more >How to detect if webpack-dev-server is running?
The webpack dev server will now set the WEBPACK_DEV_SERVER environment variable, allowing for a more robust way to check. const isDevServer = process.env....
Read more >webpack-dev-server - npm
[options] Run the webpack dev server. Options: -c, --config <value...> Provide path to a webpack configuration file e.g. ./webpack.config.js. -- ...
Read more >DevServer - webpack 3 documentation
If you're using dev-server through the Node.js API, the options in devServer will be ignored. Pass the options as a second parameter instead:...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Glad to see we’re getting to debugging 😃
A few notes on debugging:
Sourcemaps
In order for any kind of debugging to work, one of the most important requirements is that sourcemaps for all the sources that end up participating at runtime (both client and server) are present and correct (and correctly linked/made available to the runtimes). Most compilers and bundlers such as webpack provide good sourcemap support out of the box, but tinkering with things like Babel macros can easily break them. A while back I tried to implement debugging and I ran into a few walls here, but I figured that it was lower priority (make it work, make it right, make it fast), so I didn’t bring it up. We can always fix sourcemaps manually if they are broken. I haven’t tried with the current version of Redwood so I don’t know how things stand. Just keep it in mind if you run into issues (ex: breakpoints not being correctly set).
Processes
There are two processes that Redwood users may want to debug:
lambda dev serverbrowser processThere is a third process: The webpack-dev-server process itself. Unless you’re a Redwood framework developer, it is unlikely you’ll want to debug it.
Lambda dev server (api side)
This process is owned by the CLI. Therefore, the CLI is responsible for starting the sub-process with
--inspect. We need to implement this. Instead of reinventing the wheel, we could allow users to pass all of Node.js’s debug related command line options or, as @peterp suggests, have a generic mechanism for forwarding like--(ex:yarn rw cmd -- a b c=d).Browser process (web side)
This one is not our responsibility. Tools such as VSCode have the ability to launch Chrome in debug mode and leverage the DevTools protocol to enable debugging. If the sourcemaps are correct (which is our responsibility) then this is an IDE + Webpack affair. We just need to provide a cookbook with instructions. I will also provide a launch configuration automatically when using Decoupled Studio.
What do you think of a separate command
yarn rw dev:inspectoryarn rw debuginstead? Might give you more room to change things!