mirror of
https://github.com/jbranchaud/til
synced 2026-01-05 16:18:01 +00:00
Add Link A JavaScript Package Locally as a javascript til
This commit is contained in:
@@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
|||||||
For a steady stream of TILs from a variety of rocketeers, checkout
|
For a steady stream of TILs from a variety of rocketeers, checkout
|
||||||
[til.hashrocket.com](https://til.hashrocket.com/).
|
[til.hashrocket.com](https://til.hashrocket.com/).
|
||||||
|
|
||||||
_631 TILs and counting..._
|
_632 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -237,6 +237,7 @@ _631 TILs and counting..._
|
|||||||
- [Initialize A New JavaScript Project With Yarn](javascript/initialize-a-new-javascript-project-with-yarn.md)
|
- [Initialize A New JavaScript Project With Yarn](javascript/initialize-a-new-javascript-project-with-yarn.md)
|
||||||
- [Install The Latest Version Of Node With Nvm](javascript/install-the-latest-version-of-node-with-nvm.md)
|
- [Install The Latest Version Of Node With Nvm](javascript/install-the-latest-version-of-node-with-nvm.md)
|
||||||
- [ISO-8601 Formatted Dates Are Interpreted As UTC](javascript/iso-8601-formatted-dates-are-interpreted-as-utc.md)
|
- [ISO-8601 Formatted Dates Are Interpreted As UTC](javascript/iso-8601-formatted-dates-are-interpreted-as-utc.md)
|
||||||
|
- [Link A JavaScript Package Locally](javascript/link-a-javascript-package-locally.md)
|
||||||
- [List Top-Level NPM Dependencies](javascript/list-top-level-npm-dependencies.md)
|
- [List Top-Level NPM Dependencies](javascript/list-top-level-npm-dependencies.md)
|
||||||
- [Matching Multiple Values In A Switch Statement](javascript/matching-multiple-values-in-a-switch-statement.md)
|
- [Matching Multiple Values In A Switch Statement](javascript/matching-multiple-values-in-a-switch-statement.md)
|
||||||
- [New Dates Can Take Out Of Bounds Values](javascript/new-dates-can-take-out-of-bounds-values.md)
|
- [New Dates Can Take Out Of Bounds Values](javascript/new-dates-can-take-out-of-bounds-values.md)
|
||||||
|
|||||||
25
javascript/link-a-javascript-package-locally.md
Normal file
25
javascript/link-a-javascript-package-locally.md
Normal 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.
|
||||||
Reference in New Issue
Block a user