1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-04 23:58:01 +00:00

Add Link A JavaScript Package Locally as a javascript til

This commit is contained in:
jbranchaud
2018-03-03 22:16:17 -06:00
parent 7361e5d737
commit 8ddebbdacd
2 changed files with 27 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
# Link A JavaScript Package Locally
If you are putting together a JavaScript package and you'd like to test it
out locally before putting it on NPM, use `npm link`.
First, from the directory of the package you are creating run:
```bash
$ npm link
```
This will symlink the package to the global node modules directory.
Then, from the base project directory that you want to try importing and
using the package from, run:
```bash
$ npm link name-of-package
```
This will create an additional symlink from the global node modules
directory to the `node_modules` of this target project.
You'll now have access to the project, try an `import` to get what you need
and try it out.