The modular concept and front-end applications

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 )

  1. Create a file package.json

    $ npm init -y
    
  2. 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

  3. 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

  4. Command line login npmjs warehouse

    $ npm adduser
    
  5. Create a module and export module

  6. See if your name is already in use package

  7. Release package

    $ npm publish
    

Guess you like

Origin blog.csdn.net/qq_33721570/article/details/93400185