Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Package.json, add local directory to node-modules

I have local library for some graphs and I need add it to node_modules. Is there any way how to add this library using package.json?

Our package.json looks like:

{
  "name": "name",
  "version": "1.01.01",
  "scripts": {
   ...
  },
  "dependencies": {
   ...
  },
   ...
}

I mean to add something like:

  "directory": {
    "my-library": "./src/path/to/my/lib"
  }

Thank for any help.

like image 324
cherioss Avatar asked Feb 15 '26 22:02

cherioss


1 Answers

According to the documentation you can define your local directories as dependencies in the following format:

{
  "name": "baz",
  "dependencies": {
    "bar": "file:../foo/bar"
  }
}

You can read more here: https://docs.npmjs.com/files/package.json#local-paths

like image 73
Csaba Avatar answered Feb 19 '26 10:02

Csaba



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!