Post

npm的一些使用

npm的一些使用

package.json 配置

  • 使用github的组件
    • 支持github的 username/modulename 的写法,#后边可以加后缀写明分支hash或标签
    • git://github.com/iview/iview#2.0
    1
    2
    3
    4
    5
    6
    
      {
        "name": "iview",
        "dependencies": {
          "iview": "git://github.com/iview/iview#2.0"
        }
      }
    
  • 使用本地的组件
    • npm install --save ./iview
    • package.json文件中是这样的配置
    1
    2
    3
    4
    5
    6
    
      {
        "name": "iview",
        "dependencies": {
          "iview": "file:iview"
        }
      }
    
This post is licensed under CC BY 4.0 by the author.