# Debugging @pitcher/core module

In this part, we will present how to debug @pitcher/core module in a consumer application. There are multiple options to debug core package.

This approach is highly recommended as you can immediately see the effects of your changes inside the consumer project and rely on the results.

To start debugging core package inside your application:

  1. Open node_modules/@pitcher/core/package.json file
  2. Find main and module keys, change both values to src/index.js
  3. Debug/Change anyting inside node_modules/@pitcher/core/src package to see effects live
  4. 🎉 Send a pull request with your changes to pitcher-js-platform repository

NOTE

Do not forget to change back main and module entries to it is original values. Or simply just re-install the package with npm install @pitcher/core@latest

# Option 2: Linking the package

This approach might not always work properly, as linking has a strange behaviour in some cases.

To start debugging core package with linking:

  1. Clone pitcher-js-platform repository
  2. Install dependencies with running yarn install in the root directory of the project
  3. After installing the dependencies, go to the core package folder in the command line with cd packages/core
  4. In this path, simply run yarn link, note the package name here (@pitcher/core)
  5. Then go to your project that uses the core package, open a command line
  6. Then run yarn link @pitcher/core. NOTE that you might need to uninstall @pitcher/core package from your project first

More about linking exist in Yarn documentation (opens new window)

NOTE

To reverse this process, simply use yarn unlink or yarn unlink [package]