The modular front end
The modular front end
Modular: an object (broadly) having a specific function in
the process definition module:
1. The definition module (object)
2. export module
3. referenced module
benefits: storing a plurality of separate functional blocks, high reusability
type :
AMD (require.js)
CMD (sea.js)
common.js
CommonJS used on the server side, AMD and CMD used in browser environment
a detailed description of the three: https://www.jianshu.com/p/d67bc79976e6
Node.js common.js specification using
fallible understood:
common.js × belonging to node
node belongs common.js ×
Node.js Common.js specification in use are of three types:
first: built-in module (mounted built-in module refers to the global object body Node.js API)
second: custom modules
Third: first tripartite modules (packaged others)
Custom Modular upload
Since upload a custom module ( http://www.npmjs.com )
-
Create a file package.json
$ npm init -y
-
Register an account on this site http://www.npmjs.com
Note: the first landing will send a message to your mailbox (this is sent manually), then activate the landing-mail
-
Check your source computer is not the source npm
$ nrm ls
If so, it will not bother
If not, then switch to the source npm
-
Command line login npmjs warehouse
$ npm adduser
-
Create a module and export module
-
See if your name is already in use package
-
Release package
$ npm publish