引言:

  如果刚开始使用 vue 并不了解 nodejs、npm 相关知识可以看我上一篇的实践,快速入门了解实战知识树。

  1. Vue实战-入门篇

  上篇反思:

    1、新的关注点:开发 vue 模板、如何使用本地 vue 模板。

    2、关于学习:

      1、学习不能急于求成,要有计划、有前瞻性、知识体系要完整。

      2、学习不能马虎,要透过现象看本质。要将遇到的问题归纳分类,举一反三,提升分析问题的能力。

      3、要根据自己情况定义 学习粒度 并和实际情况结合起来形成具有个人特色的策略性思维。


正文:

Vue实战-配置篇-npm

1、npm 配置 package.json 文件。

使用命令 npm init 创建一个新的 package.json 文件。

如图:

: init This utility will walk you through creating a package. json file. It only covers the most common items, and tries to guess sensible defaults. See npm help j son for definitive documentation on these fields and exactly what they do. package. json npm help json se npm install (pkg) - afterwards to install a package and save it as a dependency in the package. json file. x ress "C at any time to quit. ackage name: (npm) npminittest version: (1. 0. 0) description: npm init test entry point: (index. js) entrypointjs. npm install hQ8 git test command: git repository: keywords : author: zws license: (ISC) bout to write to C: \ npminittest" name . • ". "1.0. o", verslon "descri tion . n m init m ackage. J son: test" " src="file:///C:/Users/18410/Desktop/%E6%96%B0%E5%BB%BA%E6%96%87%E4%BB%B6%E5%A4%B9/Vue%E5%AE%9E%E6%88%98.files/image002.jpg" v:shapes="图片_x0020_1">

根据提示 执行 npm help json 命令 跳转到 npm 官网的帮助页面(本地html文件)。

如图我看到了:的行为受npm-config 的影响

于是紧跟着跳转准备参阅 npm-config。

你妹啊,不是可能比我想的多,是真的好多啊,不看了。。。有用的时候再查吧。。。

回头看 package.json 介绍 前面是命名规则建议之类的就不多提了,如果命名有问题会有提示的。

例:不能以点开头。

此例可以看出来 重复执行的 npm init 相当于修改。

然后是一些字段的介绍。

1、main

2、bin 设置环境变量,如果你要贡献的话需要了解一下。

比如 执行了 npm install vue@vue-cli 以后就可以在命令行调用 vue 命令了。

3、scripts 注册包各个生命周期要运行的脚本,但是我发现key是可以自定义的,比如 dist ,然后

Npm run dist 暂时记下回头再研究。

4、config 将执行 start npm_package_config_+key,这块内容比较复杂,回头再研究。

5、dependencies  依赖。

  • version Must match version exactly
  • >version Must be greater than version
  • >=version etc
  • <version
  • <=version
  • ~version "Approximately equivalent to version" See semver(7)
  • ^version "Compatible with version" See semver(7)
  • 1.2.x 1.2.0, 1.2.1, etc., but not 1.3.0
  • http://... See 'URLs as Dependencies' below
  • * Matches any version
  • "" (just an empty string) Same as *
  • version1 - version2 Same as >=version1 <=version2.
  • range1 || range2 Passes if either range1 or range2 are satisfied.
  • git... See 'Git URLs as Dependencies' below
  • user/repo See 'GitHub URLs' below
  • tag A specific version tagged and published as tag See npm-dist-tag(1)
  • path/path/path See Local Paths below

For example, these are all valid:

{ "dependencies" :
  { "foo" : "1.0.0 - 2.9999.9999"
  , "bar" : ">=1.0.2 <2.1.2"
  , "baz" : ">1.0.2 <=2.3.4"
  , "boo" : "2.0.1"
  , "qux" : "<1.0.0 || >=2.3.1 <2.4.5 || >=2.5.2 <3.0.0"
  , "asd" : "http://asdf.com/asdf.tar.gz"
  , "til" : "~1.2"
  , "elf" : "~1.2.3"
  , "two" : "2.x"
  , "thr" : "3.3.x"
  , "lat" : "latest"
  , "dyl" : "file:../dyl"
  }
}

粘过来方便查看。

6、DEFAULT VALUES 一些缺省值

(url) format, where email and url are optional. Lines which start
with a S or are blank, will be ignored. " src="file:///C:/Users/18410/Desktop/%E6%96%B0%E5%BB%BA%E6%96%87%E4%BB%B6%E5%A4%B9/Vue%E5%AE%9E%E6%88%98.files/image016.jpg" border="0" v:shapes="图片_x0020_8">

现阶段需要了解这些就够了。

最后,npm 官网入门里有一节 understanding packages and modules推荐阅读。

2、Vue实战-配置篇-npm配置的更多相关文章

  1. [ASP.NET Core开发实战]基础篇06 配置

    配置,是应用程序很重要的组成部分,常常用于提供信息,像第三方应用登录钥匙.上传格式与大小限制等等. ASP.NET Core提供一系列配置提供程序读取配置文件或配置项信息. ASP.NET Core项 ...

  2. 1、Vue 实战-入门篇

    先决条件:需要 Node.js . npm 基础. 如果没有基础看先看下面简单的两点介绍. 1.npm 命令介绍. 1.所有命令  -h 可以查看.也可以从官网查 docs,结果如下. --help ...

  3. Hadoop学习18--yarn配置篇-基本配置节点

    <configuration> <property> <name>yarn.nodemanager.aux-services</name> <va ...

  4. iView 实战系列教程(21课时)_1.iView 实战教程之配置篇

    1.iView 实战教程之配置篇 点击添加插件,. 选中后安装 全部导入还是按需导入. 2.是否需要自定义主题变量 3.多语言的设置. 这里我们全部选择为默认 然后点击继续. 启动项目 入口文件导入了 ...

  5. webpack构建vue项目(配置篇)

    最近公司要求用vue重构项目,还涉及到模块化开发,于是乎,我专门花了几天的时间研究了一下webpack这个目前来看比较热门的模块加载兼打包工具,发现上手并不是很容易,现将总结的一些有关配置的心得分享出 ...

  6. Vue + Webpack + Vue-loader 系列教程(2)相关配置篇

    原文地址:https://lvyongbo.gitbooks.io/vue-loader/content/ 使用预处理器 在 Webpack 中,所有的预处理器需要和一个相应的加载器一同使用.vue- ...

  7. spring boot实战(第十三篇)自动配置原理分析

    前言 spring Boot中引入了自动配置,让开发者利用起来更加的简便.快捷,本篇讲利用RabbitMQ的自动配置为例讲分析下Spring Boot中的自动配置原理. 在上一篇末尾讲述了Spring ...

  8. webpack3.x版本实战案例【基础配置篇】(一)

    本文旨在通过一个一个实战例子来学习webpack如何配置,更加深入的学习webpack在实战项目中如何配置. 我们学习哪些配置呢? [基础配置] 打包JS 编译ES6 编译typeScript 打包公 ...

  9. vue爬坑之路(webpack 配置篇)

    在vue cli下 1.npm run dev 打开浏览器在config的index.js中修改autoOpenBrowser为true 关闭sourcemap productionSourceMap ...

随机推荐

  1. 智课雅思短语---三、unshakable duty

    智课雅思短语---三.unshakable duty 一.总结 一句话总结:不可推卸的义务 unshakable duty 1.satisfy/ meet the needs of…? 满足需求 2. ...

  2. HDU 6709“Fishing Master”(贪心+优先级队列)

    传送门 •参考资料 [1]:2019CCPC网络选拔赛 H.Fishing Master(思维+贪心) •题意 池塘里有 n 条鱼,捕捉一条鱼需要花费固定的 k 时间: 你有一个锅,每次只能煮一条鱼, ...

  3. UVa 1152 -4 Values whose Sum is 0—[哈希表实现]

    The SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute ...

  4. vue-learning:40 - Vuex - 第一篇:概念和基本使用

    vuex 第一篇 目录 vuex概念 state / mapState getter / mapGetter mutation / mapMutation action / mapAction mod ...

  5. vue中的时间修饰符stop,self

    stop阻止自身以外的冒泡 self只会阻止自身冒泡

  6. [板子]KMP

    KMP板子,你甚至可以用这个板子A掉luogu的3375 基础懒得说,要求一个Next数组. #include<cstdio> #include<algorithm> #inc ...

  7. wpf passwobox 添加水印

    之前有做过wpf texbox添加水印,这个并不难 重写一下样式就可以了,今天用到了passwordbox 添加水印的时候 发现还是有点难度的. 这个难度就在于如何去取password的长度来控制水印 ...

  8. k8s生产环境部署

    建议配置: 服务器 900G*2 SSD 安装操作系统 CPU 16核心*2 40G网卡*2 RAM 64G*8 操作系统建议:Centos7.4/Centos 7.6 不建议使用CentOS8 分布 ...

  9. Checkpoint 防火墙修改网卡buffer

    近期有一台CP5100频繁丢包,修改网卡buffer步骤如下,默认的网卡buffer为256,最大可以修改为4096,其步骤如下: step1:ssh登录checkpoint 防火墙控制台 step2 ...

  10. Visual Studio Team Services and Team Foundation Server官方资料入口

    Team Foundation Server msdn 中文文档入口 Visual Studio Team Services or Team Foundation Server www.visuals ...