# TypeScript और transpilation — Webpack

Source: https://www.geekswithgeeks.com/hi/webpack/webpack-20

> Webpack के साथ TypeScript use करें।

## TypeScript integration

Webpack नatively TypeScript को समझता नहीं है। ts-loader या babel-loader use करें। ts-loader build के दौरान type checking provide करता है। fork-ts-checker-webpack-plugin parallel में type checking चलाता है।

## TypeScript को configure करें

ts-loader को parallel type checking के साथ set up करें।

```javascript
const ForkTsCheckerPlugin = require('fork-ts-checker-webpack-plugin');

module.exports = {
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        loader: 'ts-loader',
        options: { transpileOnly: true }
      }
    ]
  },
  plugins: [new ForkTsCheckerPlugin()]
};
```

Output:

```
TypeScript compiled with parallel type checking
```

## Speed के लिए transpileOnly

transpileOnly: true को set करके ts-loader में type checking को skip करें, fork-ts-checker को अलग से चलने दें। यह rebuilds को significantly तेज करता है।

त्वरित जाँच

**Quiz:** fork-ts-checker-webpack-plugin क्या करता है?

- [x] Faster builds के लिए parallel में type checking चलाता है।
- [ ] Bundle से TypeScript को remove करता है।
- [ ] TypeScript में decorators को enable करता है।

*Answer:* Faster builds के लिए parallel में type checking चलाता है।. fork-ts-checker-webpack-plugin type checking को अलग process में transfer करता है, faster compilation को allow करता है।
