1

I have two local JavaScript projects. Let's call them spinner and admin.

spinner is part of a dependency for admin. However, there's a bug in spinner and I need to fix this bug. I thin I have fixed the bug, but I don't know how to reload this dependency without pushing to github and running npm update.

Is there any way to either live reload the dependency or update the dependency locally to test my fix in the admin project?

ILikeTacos
  • 17,464
  • 20
  • 58
  • 88
  • You can explore using [npm-link](https://docs.npmjs.com/cli/link.html). You can link your npm packages locally without publishing to npm. – junwen-k Nov 21 '19 at 16:03
  • You should be able to modify your package.json to use a specific directory for your module: eg `"dependencies": { "spinner":"file:/path/to/spinner" }` so you could point it to your build output directory for your module. Not sure if there is a way of specifying that as a devDep and have it override a normal dep though (eg for dev vs prod building) – Patrick Evans Nov 21 '19 at 16:14
  • Simply rename the dependency folder to something like `spinner_original`. Then create a symlink to your updated dependency: `spinner ---> /updated/spinner`. On unix-derived systems, you could do it with `ln -s /project/admin/node_modules/spinner /updated/spinner`. – Tomasz Kasperczyk Nov 21 '19 at 16:40

1 Answers1

-1

in admin's package.json

{
  "dependencies":{
  ...
  "spinner":"path/path/path",
  ...
  }
}

local-paths

i474232898
  • 781
  • 14
  • 25