The best way to add an npm package on meteor?


I’d like to add an npm package, and I’ve been looking into Meteorhacks’ npm package, is this currently the best (=recommended) way to add npm packages to a meteor project?


That’s probably the easiest way but I prefer the official way:

Mega simple example based on Maxpain177s work:


Where would add the “Npm.depends” ?
Must I divide my project into packages (like one of the methods of folder structures) in order to write that inside the package.js or is there an alternative in case i’m using the classic client/, lib/, server/ folder structure?


See here

Yes, if you want to use Npm.depends you have to make it into a package.

While in your project directory type

meteor create --package my-package
meteor add my-package

Example output from my current project:

C:\dev\infoAdmin>meteor create --package my-package
my-package: created in packages\my-package

C:\dev\infoAdmin>meteor add my-package

Changes to your project's package version selections:

my-package  added, version 0.0.1




I’m working on a package, rocket:module, that will be another way of using external libraries from npm, and writing entry points using CommonJS/AMD/ES6 Modules. More info in this post.