简体   繁体   English

babel-cli vs babel-preset-es2015 vs babel-register vs babel-core?

[英]babel-cli vs babel-preset-es2015 vs babel-register vs babel-core?

What are all these babel dependencies? 这些babel依赖是什么? What are each of them for and how do they differ? 它们各有什么不同,它们有何不同? Which one should I use for my nodejs web app? 我应该将哪一个用于我的nodejs网络应用程序?

I have looked on the API website but is there any guide that puts these into simple human English? 我查看了API网站,但有没有指南将这些简单的人类英语?

In simple terms: 简单来说:

  • babel-cli : Is the one you would use if you were trying to compile an ES6/ES7 module to ES5- and you had a need to do that via a terminal command. babel-cli :如果您尝试将ES6 / ES7模块编译为ES5,那么您将使用它,并且您需要通过终端命令来执行此操作。
  • babel-preset-es2015 : Is the package containing a subset of features that ES6/ES7 provides. babel-preset-es2015 :包中是否包含ES6 / ES7提供的功能子集。
  • babel-register : A require that you do and causes every file require there after to run through babel, thus allowing you to write ES6/ES7 code in every module. babel-register :要求你执行并导致每个文件后需要通过babel运行,从而允许你在每个模块中编写ES6 / ES7代码。
  • babel-core : Same as "babel-cli" except you would use it programmatically inside your app. babel-core :与“babel-cli”相同,除非您在应用程序内以编程方式使用它。

Basically, you could use "babel-register" during development with the "babel-preset-es2015" package set. 基本上,您可以在开发过程中使用“babel-register-es2015”软件包进行“babel-register”。 Then use "babel-cli" or "babel-core" to compile your files before production. 然后使用“babel-cli”或“babel-core”在生产之前编译文件。

I hope that helps. 我希望有所帮助。

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

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