Skip to content

Instantly share code, notes, and snippets.

@mhaidarhanif
Forked from kiliman/README.md
Last active October 5, 2022 07:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhaidarhanif/cadfb23044718015153376b202e6b93e to your computer and use it in GitHub Desktop.
Save mhaidarhanif/cadfb23044718015153376b202e6b93e to your computer and use it in GitHub Desktop.
Debug server-side Remix using VS Code

💡 HOWTO: Debug your server-side Remix code using VSCode

✨ New in Remix v1.3.5

The latest release of Remix fixes sourcemaps so you no longer need to use any hacks to set breakpoints in your route modules. Simply start the debugger and Remix will hit the breakpoint in your loaders and actions.

Debugging session even survives edits and Live Reload.

🐛 Launch VSCode debugger

There are a couple of options. You can use one of the launch configuration listed below, or simply open the Command Pallete and type: debug npm script. Then select the one you want to run. NOTE: Since this will relaunch your app, make sure you've stopped any running servers.

Debugging npm script

image

Attaching to a process

Pick the node process that is running the ./server/index.js file image

👀 View local variables

image

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"command": "npm run dev",
"name": "Run npm run dev",
"request": "launch",
"type": "node-terminal",
"cwd": "${workspaceFolder}"
},
{
"name": "Attach by Process ID",
"processId": "${command:PickProcess}",
"request": "attach",
"skipFiles": ["<node_internals>/**"],
"type": "pwa-node"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment