Skip to content

Instantly share code, notes, and snippets.

@mbifulco
Created November 14, 2024 17:12
Show Gist options
  • Save mbifulco/737563f17ac20690337a7e1d4ced76f5 to your computer and use it in GitHub Desktop.
Save mbifulco/737563f17ac20690337a7e1d4ced76f5 to your computer and use it in GitHub Desktop.
Need to debug a problem in one of your npm dependencies? I gotchu.

// so you're trying to debug a problem in an npm dependency... "foo-some-dependency": "^1.1307.0",

// here's how to tell package.json to use your fork of the library // so you can debug more easily

// 1. clone the dependency repo to a local directory

git clone https://github.com/user/foo-some-dependency.git /src/working-dir

// 2. update your package.json to point to the cloned directory

"foo-some-dependency": "file:/src/working-dir/foo-some-dependency",

// 3. re-install dependecies

pnpm i

// 4. now you can make changes, add console logs, breakpoints, //. etc to the dependency in your local folder to debug!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment