1.0.0 • Published 5 years ago
@evotionce/nodemoduleexample v1.0.0
nodeModuleExample
Create a node module
- Create a package.json file
//Creates a package.json in root directoy with given SCOPE-NAME [user/org]
npm init --scope=@SCOPE-NAME
Note: Scopes are used to have unique module names. For example @npm/package-name (npm is the scope)
Create file that is loaded when module is required Create the javascript file you defined for "main" in package.json and use exports to make it available to other code. Note: index.js is the default name
Publish package to npm Note: If you are not logged execute npm login first Private/unscoped packages
npm publish
Scoped public packages
npm publish --access public
- Consume module
Package.json
- "main": define starting point for node module
1.0.0
5 years ago