How to use folder as local npm package

Issue #657

Add library folder src/library

1
2
3
4
5
6
7
src
library
res.js
screens
Home
index.js
package.json

Declare package.json in library folder

1
2
3
4
{
"name": "library",
"version": "0.0.1"
}

Declare library as dependency in root package.json

1
2
3
"dependencies": {
"library": "file:src/library"
},

Now import like normal, for example in src/screens/Home/index.js

1
import res from 'library/res'

Comments