Link the component to the app

After we push the component to NPM we don't want to publish the package on every change to test it, right?

To avoid all this work we gonna use npm link to use our component locally and speed up the development.

Building

The component must be built before we can use it, so just type

npm run build and you're good to go.

NOTE: When you’re developing the component use npm run start so webpack can watch the files and build on every change.

Linking

Go to /code/awesome-btn and hit npm i . After that, npm link

If everything worked as expected you should see a message like this on your terminal:

/usr/local/lib/node_modules/awesome-btn -> /Users/your-name/code/awesome-btn

Now go to your app ( cd /code/app ) and hit npm link awesome-btn

You should see a message like this:

/Users/your-name/code/app/node_modules/awesome-btn -> /usr/local/lib/node_modules/awesome-btn -> /Users/your-name/code/awesome-btn

Sweet! The app and component are now linked!