I have recently come across a project that extensively uses cnpm for package managing. I saw something like var a = require(@renil/a);
I have never seen something like this(@) in node when requiring a module. Can anybody help me out
I have recently come across a project that extensively uses cnpm for package managing. I saw something like var a = require(@renil/a);
I have never seen something like this(@) in node when requiring a module. Can anybody help me out
Those are actually two unrelated things. cnpm I had not heard of until I saw your question. After googling, it appears to be a Chinese maintained registry of node modules. Not sure what else is different but I'd probably stay away from it unless you know you need it.
The @ symbol in a package name has to do with scoping related modules. That's well covered in the npm docs: https://docs.npmjs.com/misc/scope
These are scoped npm packages:
All npm packages have a name. Some package names also have a scope. A scope follows the usual rules for package names (url-safe characters, no leading dots or underscores). When used in package names, preceded by an @-symbol and followed by a slash, e.g.
@somescope/somepackagename
Scopes are a way of grouping related packages together, and also affect a few things about the way npm treats the package.