Skip to content

Local linking

Rodrigo Díaz edited this page Mar 21, 2018 · 1 revision

Sadly, for this to work your package needs to be registered on npm, so you must publish at least one version (even if it's a dummy one) before attempting this.


Regardless of the local development stack based on Storybook, it could be useful to see your library working directly on another project.

For example, if I'm developing the library time-input (this correspond to the name attribute of the package.json file), I could do this:

  • In the library directory:

    $ yarn link
    $ yarn start # Starts the dev mode to make some changes later
  • In the project directory:

    $ yarn link time-input
    $ yarn add time-input # If the library is not declared as a dependency yet.

Now the app can import 'time-input' and any local changes on the library dist will be reflected on the app as well.

When you're done run yarn unlink on the library folder.

Clone this wiki locally