[英]When does a build happen when you deploy a NPM package with devDependencies?
I see that most package.json
have webpack
and babel
in their devDependency list. 我看到大多数
package.json
在他们的devDependency列表中都有webpack
和babel
。 So if these aren't needed in order to use that package, that must mean these devDependencies must be used before a project installs that package, right? 因此,如果不需要这些来使用该包,那必须意味着在项目安装该包之前必须使用这些devDependencies,对吧? When does this happen?
这是什么时候发生的? Does it look like any one of the below steps?
它看起来像下面的任何一个步骤?
OR 要么
If devDependencies aren't in the picture at all, how does a package that relies on webpack and babel to transcompile its es6 into es5 work with a project that is only in es5? 如果devDependencies完全不在图片中,那么依赖webpack和babel将其es6转换为es5的包如何与仅在es5中的项目一起工作?
Dev dependencies are needed to modify the given library, they are not needed to use the library. 修改给定库需要Dev依赖项,使用库不需要它们。 When the library maintainer uploads the library to npm, they build the library using these dev dependencies first and then upload the files that were built.
当库维护者将库上传到npm时,他们首先使用这些dev依赖项构建库,然后上载构建的文件。 So you don't need to dev dependencies to use the library, the maintainer already did this build for you.
所以你不需要开发依赖项来使用库,维护者已经为你做了这个构建。
So to give your answer . 所以给你答案。 Lets talk about devdependency
让我们谈谈失去联系
babel is use for converting latest es6 uncomputable code to node.js uncomputable code . babel用于将最新的es6不可编译代码转换为node.js不可编译代码。 as the same way webpack use on development cycle
与webpack在开发周期中使用的方式相同
They are used at development time to easy the development code. 它们在开发时用于简化开发代码。
To give your question answer. 给你的问题答案。
that must mean these devDependencies must be used before a project installs that package, right?
这必须意味着必须在项目安装该软件包之前使用这些devDependencies,对吧?
Yes they are used when the package is develop by it developer . 是的,它们是在开发人员开发包时使用的。
When does this happen?
这是什么时候发生的?
when any person develop the package . 当任何人开发包装时。 for example you create a project and want to minify the js file the include the js minifier on the process of development .
例如,您创建一个项目,并希望缩小js文件,包括开发过程中的js minifier。
Does it look like any one of the below steps?
它看起来像下面的任何一个步骤?
deploy package (create a package)
package gets built
bundle along with dependencies are hosted online
npm install $package will only get bundle and dependencies
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.