简体   繁体   English

如果我只发布库的包,我应该将我的库依赖项放入 devDependencies 中吗?

[英]Should i put my library dependencies into devDependencies if I only publish the bundle of the library?

If i generate a bundle of a library, should I put the library dependencies in devDependencies ?如果我生成一个库包,我应该将库依赖项放在devDependencies中吗?

I'm authoring a NPM library written in TypeScript which uses a quite amount of dependencies, such as React components.我正在创作一个用 TypeScript 编写的 NPM 库,它使用了大量的依赖项,例如 React 组件。 We do some build steps to compile down to JavaScript files, apply minification and bundle into a single JS file.我们执行一些构建步骤来编译到 JavaScript 个文件,应用缩小并捆绑到单个 JS 文件中。 The final published package for this library will contain just a JS file, the output of this build steps.该库的最终发布 package 将仅包含一个 JS 文件,即此构建步骤的 output。

When I install the package all the dependencies of this library will be installed as well.当我安装 package 时,这个库的所有依赖项也将被安装。 Should I put those libraries as devDependencies instead in the package.json, given that they are not needed because the JS file will already bundle them?我是否应该将这些库作为devDependencies而不是放在 package.json 中,因为不需要它们,因为 JS 文件已经将它们捆绑在一起?

Not sure about the way you build.不确定您的构建方式。

Not needed to put all devdependencies if it is already part of the js file.如果它已经是 js 文件的一部分,则不需要放置所有 devdependencies。

If it is going to be only a js file, it can be hosted as CDN file.如果它只是一个 js 文件,它可以作为 CDN 文件托管。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM