Skip to main content

Babel 医生

· 2 min read

Babel Doctor 深受 Sindre Sorhus 的 Yeoman Doctor 的影响,几乎是直接抄袭来的。


babel-doctor 已在 babel-cli 的 v6.18.0 版本中移除。如果有人需要,我们会把它作为一个独立的 npm 模块 babel-doctor 回归。

我们上周发布了Babel 6。这相较于之前附带的Babel版本是一个相当大的变化,同时也带来了一系列潜在的环境问题。

🌐 We launched Babel 6 last week. This was a pretty big change from the previous batteries included Babel and with it came a host of potential environment issues.

为了应对这一情况,我们现在在 babel-cli 中加入了一个 babel-doctor 命令,它可以检测你 Babel 安装中常见的问题,比如:

🌐 In order to combat this we now include a babel-doctor command with the babel-cli that detects common problems with your Babel installation such as:

  • 缺少 .babelrc。
  • 复制 Babel 核心模块
  • 过时的 Babel 核心模块

用法​

🌐 Usage

首先,确保你已经安装了 Babel CLI。

🌐 First, make sure you have the Babel CLI installed.

Shell
$ npm install -g babel-cli@^6.1.0

然后只需将 cd 放入你的项目目录并运行:

🌐 Then simply cd into your project directory and run:

Shell
$ babel-doctor

Babel Doctor
Running sanity checks on your system. This may take a few minutes...

✔ Found config at /Users/sebastian/.babelrc
✔ All babel packages appear to be up to date
✔ No duplicate babel packages found

Everything looks all right!


我们希望这能让你在项目中更容易地设置和使用 Babel。

🌐 We hope this makes it easier to setup and use Babel in your project.

祝你编程愉快!

🌐 Happy hacking!