Skip to content
Vy logo
Guides

How to Test Spor Locally

A guide on how to test the spor-react package locally with other apps.

Before releasing a new version of Spor, you may want to test changes in your app. There are two ways to do this: using npm pack or npm link. Both methods have their use cases, so pick the one that works best for you.

This method creates a .tgz package of spor-react, which can be installed locally in another project. It's stable but requires a manual reinstallation after each change.

1️⃣ Navigate to spor-react in the terminal

cd packages/spor-react

2️⃣ Run npm pack to create a local package

npm pack

This will generate a file, e.g., vygruppen-spor-react-10.9.2.tgz. The version may differ.

3️⃣ Install the local package in your app

npm install --save ../spor/packages/spor-react/vygruppen-spor-react-10.9.2.tgz

Your package.json should now look like this:

"@vygruppen/spor-react": "file:../spor/packages/spor-react/vygruppen-spor-react-10.9.2.tgz",

Your app now uses the local version of spor-react!

📌 Note: If you make further changes to spor-react, you must rerun npm pack and reinstall the package to update your app.

This method symlinks spor-react into your app, allowing real-time updates without reinstalling. However, it can sometimes cause dependency resolution issues.

1️⃣ Navigate to spor-react and create a global link

cd packages/spor-react
npm link

2️⃣ Navigate to your app and link spor-react

cd path-to-your-app
npm link @vygruppen/spor-react

Your app is now using the local version of spor-react with live updates! No need to reinstall after changes—just refresh your app.

📌 Note: If you encounter dependency issues, try running:

rm -rf node_modules package-lock.json && npm install

To unlink after testing, run:

npm unlink @vygruppen/spor-react && npm install

🛠 Troubleshooting

If you run into issues, reach out to us in the repository issues or the #team-kanaler channel on Slack! 🚀