11---
2- title : Integrating with Build Tools
2+ title : 与构建工具集成
33layout : docs
44permalink : /zh/docs/handbook/integrating-with-build-tools.html
5- oneline : How to use TypeScript with other build tools
5+ oneline : 如何将 TypeScript 与其他构建工具一起使用
66---
77
88## Babel
99
10- ### Install
10+ ### 安装
1111
1212``` sh
1313npm install @babel/cli @babel/core @babel/preset-typescript --save-dev
@@ -21,7 +21,7 @@ npm install @babel/cli @babel/core @babel/preset-typescript --save-dev
2121}
2222```
2323
24- ### Using Command Line Interface
24+ ### 使用命令行接口
2525
2626``` sh
2727./node_modules/.bin/babel --out-file bundle.js src/index.ts
@@ -37,27 +37,27 @@ npm install @babel/cli @babel/core @babel/preset-typescript --save-dev
3737}
3838```
3939
40- ### Execute Babel from the command line
40+ ### 通过命令行执行 Babel
4141
4242``` sh
4343npm run build
4444```
4545
4646## Browserify
4747
48- ### Install
48+ ### 安装
4949
5050``` sh
5151npm install tsify
5252```
5353
54- ### Using Command Line Interface
54+ ### 使用命令行接口
5555
5656``` sh
5757browserify main.ts -p [ tsify --noImplicitAny ] > bundle.js
5858```
5959
60- ### Using API
60+ ### 使用 API
6161
6262``` js
6363var browserify = require (" browserify" );
@@ -70,19 +70,19 @@ browserify()
7070 .pipe (process .stdout );
7171```
7272
73- More details: [ smrq/tsify] ( https://github.com/smrq/tsify )
73+ 更多细节,详见: [ smrq/tsify] ( https://github.com/smrq/tsify )
7474
7575## Grunt
7676
77- ### Using ` grunt-ts ` (no longer maintained)
77+ ### 使用 ` grunt-ts ` (已停止维护)
7878
79- #### Install
79+ #### 安装
8080
8181``` sh
8282npm install grunt-ts --save-dev
8383```
8484
85- #### Basic Gruntfile.js
85+ #### 基础的 Gruntfile.js
8686
8787``` js
8888module .exports = function (grunt ) {
@@ -98,17 +98,17 @@ module.exports = function (grunt) {
9898};
9999```
100100
101- More details: [ TypeStrong/grunt-ts] ( https://github.com/TypeStrong/grunt-ts )
101+ 更多细节,详见: [ TypeStrong/grunt-ts] ( https://github.com/TypeStrong/grunt-ts )
102102
103- ### Using ` grunt-browserify ` combined with ` tsify `
103+ ### 将 ` grunt-browserify ` 以及 ` tsify ` 组合在一起使用
104104
105- #### Install
105+ #### 安装
106106
107107``` sh
108108npm install grunt-browserify tsify --save-dev
109109```
110110
111- #### Basic Gruntfile.js
111+ #### 基础的 Gruntfile.js
112112
113113``` js
114114module .exports = function (grunt ) {
@@ -128,17 +128,17 @@ module.exports = function (grunt) {
128128};
129129```
130130
131- More details: [ jmreidy/grunt-browserify] ( https://github.com/jmreidy/grunt-browserify ) , [ TypeStrong/tsify] ( https://github.com/TypeStrong/tsify )
131+ 更多细节,参见: [ jmreidy/grunt-browserify] ( https://github.com/jmreidy/grunt-browserify ) 、 [ TypeStrong/tsify] ( https://github.com/TypeStrong/tsify )
132132
133133## Gulp
134134
135- ### Install
135+ ### 安装
136136
137137``` sh
138138npm install gulp-typescript
139139```
140140
141- ### Basic gulpfile.js
141+ ### 基础的 gulpfile.js
142142
143143``` js
144144var gulp = require (" gulp" );
@@ -155,33 +155,33 @@ gulp.task("default", function () {
155155});
156156```
157157
158- More details: [ ivogabe/gulp-typescript] ( https://github.com/ivogabe/gulp-typescript )
158+ 更多细节,参见: [ ivogabe/gulp-typescript] ( https://github.com/ivogabe/gulp-typescript )
159159
160160## Jspm
161161
162- ### Install
162+ ### 安装
163163
164164``` sh
165165npm install -g jspm@beta
166166```
167167
168- _ Note: Currently TypeScript support in jspm is in 0.16beta _
168+ _ 注: 目前, TypeScript 在 jspm 中的 0.16beta 版本中受支持。 _
169169
170- More details: [ TypeScriptSamples/jspm] ( https://github.com/Microsoft/TypeScriptSamples/tree/master/jspm )
170+ 更多细节,参见: [ TypeScriptSamples/jspm] ( https://github.com/Microsoft/TypeScriptSamples/tree/master/jspm )
171171
172172## MSBuild
173173
174- Update project file to include locally installed ` Microsoft.TypeScript.Default.props ` (at the top) and ` Microsoft.TypeScript.targets ` (at the bottom) files:
174+ 更新项目文件以包含本地安装的 ` Microsoft.TypeScript.Default.props ` (位于顶部)和 ` Microsoft.TypeScript.target ` (位于底部)文件:
175175
176176``` xml
177177<?xml version =" 1.0" encoding =" utf-8" ?>
178178<Project ToolsVersion =" 4.0" DefaultTargets =" Build" xmlns =" http://schemas.microsoft.com/developer/msbuild/2003" >
179- <!-- Include default props at the top -->
179+ <!-- 在顶部包含默认属性 -->
180180 <Import
181181 Project =" $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props"
182182 Condition =" Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props')" />
183183
184- <!-- TypeScript configurations go here -->
184+ <!-- TypeScript 配置在这里 -->
185185 <PropertyGroup Condition =" '$(Configuration)' == 'Debug'" >
186186 <TypeScriptRemoveComments >false</TypeScriptRemoveComments >
187187 <TypeScriptSourceMap >true</TypeScriptSourceMap >
@@ -191,37 +191,37 @@ Update project file to include locally installed `Microsoft.TypeScript.Default.p
191191 <TypeScriptSourceMap >false</TypeScriptSourceMap >
192192 </PropertyGroup >
193193
194- <!-- Include default targets at the bottom -->
194+ <!-- 默认目标在底部 -->
195195 <Import
196196 Project =" $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets"
197197 Condition =" Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets')" />
198198</Project >
199199```
200200
201- More details about defining MSBuild compiler options: [ Setting Compiler Options in MSBuild projects ] ( /zh /docs/handbook/compiler-options-in-msbuild.html)
201+ 有关配置 MSBuild 编译器选项的更多详情: [ 在 MSBuild 项目中设置编译器选项 ] ( /docs/handbook/compiler-options-in-msbuild.html )
202202
203203## NuGet
204204
205- - Right-Click -> Manage NuGet Packages
206- - Search for ` Microsoft.TypeScript.MSBuild `
207- - Hit ` Install `
208- - When install is complete, rebuild!
205+ - 右击 -> 管理 NuGet 软件包
206+ - 搜索 ` Microsoft.TypeScript.MSBuild `
207+ - 点击 ` Install `
208+ - 安装完成后,重新构建!
209209
210- More details can be found at [ Package Manager Dialog ] ( http://docs.nuget.org/Consume/Package-Manager-Dialog ) and [ using nightly builds with NuGet] ( https://github.com/Microsoft/TypeScript/wiki/Nightly-drops#using-nuget-with-msbuild )
210+ 更多详情,请参阅 [ 软件包管理器对话框 ] ( http://docs.nuget.org/Consume/Package-Manager-Dialog ) 和 [ 使用 NuGet 进行每日构建 ] ( https://github.com/Microsoft/TypeScript/wiki/Nightly-drops#using-nuget-with-msbuild )
211211
212212## Rollup
213213
214- ### Install
214+ ### 安装
215215
216216```
217217npm install @rollup/plugin-typescript --save-dev
218218```
219219
220- Note that both ` typescript ` and ` tslib ` are peer dependencies of this plugin that need to be installed separately.
220+ 请注意, ` typescript ` 和 ` tslib ` 都是该插件的对等依赖项,需要单独安装。
221221
222- ### Usage
222+ ### 用法
223223
224- Create a ` rollup.config.js ` [ configuration file ] ( https://www.rollupjs.org/guide/en/#configuration-files ) and import the plugin:
224+ 创建 ` rollup.config.js ` [ 配置文件 ] ( https://www.rollupjs.org/guide/en/#configuration-files ) 并导入插件:
225225
226226``` js
227227// rollup.config.js
@@ -237,54 +237,54 @@ export default {
237237};
238238```
239239
240- ## Svelte Compiler
240+ ## Svelte 编译器
241241
242- ### Install
242+ ### 安装
243243
244244```
245245npm install --save-dev svelte-preprocess
246246```
247247
248- Note that ` typescript ` is an optional peer dependencies of this plugin and needs to be installed separately. ` tslib ` is not provided either.
248+ 请注意, ` typescript ` 是本插件的可选对等依赖项,需要单独安装。 ` tslib ` 也没有被提供。
249249
250- You may also consider [ ` svelte-check ` ] ( https://www.npmjs.com/package/svelte-check ) for CLI type checking.
250+ 你也可以考虑使用 [ ` svelte-check ` ] ( https://www.npmjs.com/package/svelte-check ) 进行命令行类型检查。
251251
252- ### Usage
252+ ### 用法
253253
254- Create a ` svelte.config.js ` configuration file and import the plugin:
254+ 创建 ` svelte.config.js ` 配置文件并导入插件:
255255
256256``` js
257257// svelte.config.js
258258import preprocess from ' svelte-preprocess' ;
259259
260260const config = {
261- // Consult https://github.com/sveltejs/svelte-preprocess
262- // for more information about preprocessors
261+ // 查询 https://github.com/sveltejs/svelte-preprocess
262+ // 获取更多有关预处理器的信息
263263 preprocess: preprocess ()
264264};
265265
266266export default config ;
267267```
268268
269- You can now specify that script blocks are written in TypeScript:
269+ 现在,你可以指定使用 TypeScript 编写脚本块:
270270
271271```
272272<script lang="ts">
273273```
274274
275275## Vite
276276
277- Vite supports importing ` .ts ` files out-of-the-box. It only performs transpilation and not type checking. It also requires that some ` compilerOptions ` have certain values. See the [ Vite docs ] ( https://vitejs.dev/guide/features.html#typescript ) for more details.
277+ Vite 原生支持导入 ` .ts ` 文件。 它只进行转译,不进行类型检查。它还要求某些 ` compilerOptions ` 具有特定的值。详情请参见 [ Vite 文档 ] ( https://vitejs.dev/guide/features.html#typescript ) 。
278278
279279## Webpack
280280
281- ### Install
281+ ### 安装
282282
283283``` sh
284284npm install ts-loader --save-dev
285285```
286286
287- ### Basic webpack.config.js when using Webpack 5 or 4
287+ ### 使用 Webpack 5 或 4 时的基础 webpack.config.js
288288
289289``` js
290290const path = require (' path' );
@@ -310,8 +310,8 @@ module.exports = {
310310};
311311```
312312
313- See [ more details on ts-loader here ] ( https://www.npmjs.com/package/ts-loader ) .
313+ 此处参见 [ ts-loader 的更多详情 ] ( https://www.npmjs.com/package/ts-loader ) 。
314314
315- Alternatives:
315+ 替代品:
316316
317317- [ awesome-typescript-loader] ( https://www.npmjs.com/package/awesome-typescript-loader )
0 commit comments