How to enable node_modules also while 'npm pack'

I need to include some modules along with the application, while "npm pack". Do we have the option to enable npm modules with the application?

+4
source share
2 answers

Inside package.json, we can specify a list of dependencies that must be packaged during packaging.

....
  "bundledDependencies": [
    "dependency_1",
    "dependency_2"
]
....

More about bundledDependency can be found here. It may be more manual work of maintaining this list. There is a library called bundle-deps for this .

Using

$ bundle-deps [path/to/project]
bundled 48 dependencies.
$ npm pack
// you will see the packaged file contains all your dependencies specified.
+3
source

package module, - Node.js 'require, , npm . , , - grunt CLI, globally. .

0

Source: https://habr.com/ru/post/1668285/


All Articles