[英]How do you setup dependencies for production deploy when Babel is used in build script?
My understanding is that Babel is used for compiling codes, so it makes sense to be placed at devDependencies.我的理解是 Babel 是用来编译代码的,所以放在 devDependencies 是有意义的。
But if I include Babel command in my build script and I would like to npm install --only=prod
before npm run build
at deploy stage (or Dockerfile).但是,如果我在构建脚本中包含 Babel 命令,并且我想在 npm 在部署阶段(或 Dockerfile)
npm run build
之前npm install --only=prod
npm。
Should I move Babel and related packages like plugins, preset into dependencies?我应该将 Babel 和相关的包(如插件、预设)移动到依赖项中吗?
Just found out a reasonable solution .刚刚找到一个合理的解决方案。
If the project needs to be built by babel, then如果项目需要 babel 构建,那么
our project is no longer considered the "front end app", but instead "the project that builds the front end app.
我们的项目不再被认为是“前端应用程序”,而是“构建前端应用程序的项目。
Therefore installing babel related dependencies in production is fine.因此在生产环境中安装 babel 相关的依赖是没问题的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.