Removing unused NPM packages

I have NPM packages referenced in CloudCode tasks that I do not need. Is there overhead with leaving them there, or can/should I remove them in yarn.lock? That platform generated file has a comment that it should not be directly edited, but it is pretty easy to see what needs to go, if I do remove it.

There is an initial overhead in the deployment phase with no major effect thereafter (during runtime).

To remove the unused packages do the following:

  1. Open the package.json file of the task
  2. Locate the unused package in the dependencies node
  3. Remove the line with the package name and version e.g. Remove "moment-timezone": "^0.5.31" and make sure the formatting of the JSON is correct
  4. Run the Update yarn.lock action on the CloudCode task. This action can be found by right-clicking on the task
1 Like

That worked like a charm, thanks Mike

1 Like