---
# System prepended metadata

title: 如何用 babel 把 es6 js => es5 js
tags: [babel]

---

# 如何用 babel 把 es6 js => es5 js
###### tags: `babel`

* 1.安裝 babel cli
```
npm install --save-dev @babel/core @babel/cli
```
* 2.安裝 @babel/preset-env
```
npm install --save-dev  @babel/preset-env 
```
* 3.執行下面指令
```
npx babel [檔案位址] --presets=@babel/preset-env --out-file [輸出檔案位址]
```
ex:

```
npx babel ./package/Localization/zh-HANT-TW.js --presets=@babel/preset-env --out-file ./package/Localization/script-compiled.js
```