Skip to content

Commit a30cd42

Browse files
committed
Add Babel 7 configuration. PR826
1 parent 0ed2314 commit a30cd42

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

doc/handbook/Integrating with Build Tools.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Build tools
22

3+
* [Babel](#babel)
34
* [Browserify](#browserify)
45
* [Duo](#duo)
56
* [Grunt](#grunt)
@@ -9,6 +10,43 @@ Build tools
910
* [MSBuild](#msbuild)
1011
* [NuGet](#nuget)
1112

13+
# Babel
14+
15+
### 安装
16+
17+
```sh
18+
npm install @babel/cli @babel/core @babel/preset-typescript --save-dev
19+
```
20+
21+
### .babelrc
22+
23+
```js
24+
{
25+
"presets": ["@babel/preset-typescript"]
26+
}
27+
```
28+
### 使用命令行工具
29+
30+
```sh
31+
./node_modules/.bin/babel --out-file bundle.js src/index.ts
32+
```
33+
34+
### package.json
35+
36+
```js
37+
{
38+
"scripts": {
39+
"build": "babel --out-file bundle.js main.ts"
40+
},
41+
}
42+
```
43+
44+
### 在命令行上运行Babel
45+
46+
```sh
47+
npm run build
48+
```
49+
1250
# Browserify
1351

1452
### 安装

0 commit comments

Comments
 (0)