@ionic/angular 7.6.2-dev.11702924017.193c825c → 7.6.2-dev.11702954699.17da50be

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/LICENSE +21 -0
  2. package/directives/control-value-accessors/index.d.ts +1 -0
  3. package/directives/control-value-accessors/radio-value-accessor.d.ts +9 -0
  4. package/directives/proxies-list.d.ts +1 -1
  5. package/directives/proxies.d.ts +7 -39
  6. package/esm2020/common/directives/control-value-accessors/value-accessor.mjs +4 -4
  7. package/esm2020/common/directives/navigation/back-button.mjs +4 -4
  8. package/esm2020/common/directives/navigation/nav.mjs +4 -4
  9. package/esm2020/common/directives/navigation/router-link-delegate.mjs +7 -7
  10. package/esm2020/common/directives/navigation/router-outlet.mjs +7 -7
  11. package/esm2020/common/directives/navigation/tabs.mjs +4 -4
  12. package/esm2020/common/overlays/modal.mjs +4 -4
  13. package/esm2020/common/overlays/popover.mjs +4 -4
  14. package/esm2020/common/providers/angular-delegate.mjs +4 -4
  15. package/esm2020/common/providers/config.mjs +4 -4
  16. package/esm2020/common/providers/dom-controller.mjs +4 -4
  17. package/esm2020/common/providers/nav-controller.mjs +6 -6
  18. package/esm2020/common/providers/platform.mjs +4 -4
  19. package/esm2020/directives/control-value-accessors/boolean-value-accessor.mjs +4 -4
  20. package/esm2020/directives/control-value-accessors/index.mjs +2 -1
  21. package/esm2020/directives/control-value-accessors/numeric-value-accessor.mjs +4 -4
  22. package/esm2020/directives/control-value-accessors/radio-value-accessor.mjs +42 -0
  23. package/esm2020/directives/control-value-accessors/select-value-accessor.mjs +4 -4
  24. package/esm2020/directives/control-value-accessors/text-value-accessor.mjs +4 -4
  25. package/esm2020/directives/navigation/ion-back-button.mjs +4 -4
  26. package/esm2020/directives/navigation/ion-nav.mjs +4 -4
  27. package/esm2020/directives/navigation/ion-router-outlet.mjs +4 -4
  28. package/esm2020/directives/navigation/ion-tabs.mjs +4 -4
  29. package/esm2020/directives/navigation/router-link-delegate.mjs +7 -7
  30. package/esm2020/directives/overlays/modal.mjs +4 -4
  31. package/esm2020/directives/overlays/popover.mjs +4 -4
  32. package/esm2020/directives/proxies-list.mjs +1 -4
  33. package/esm2020/directives/proxies.mjs +237 -314
  34. package/esm2020/directives/validators/max-validator.mjs +4 -4
  35. package/esm2020/directives/validators/min-validator.mjs +4 -4
  36. package/esm2020/index.mjs +2 -1
  37. package/esm2020/ionic-module.mjs +10 -7
  38. package/esm2020/providers/action-sheet-controller.mjs +4 -4
  39. package/esm2020/providers/alert-controller.mjs +4 -4
  40. package/esm2020/providers/animation-controller.mjs +4 -4
  41. package/esm2020/providers/gesture-controller.mjs +4 -4
  42. package/esm2020/providers/loading-controller.mjs +4 -4
  43. package/esm2020/providers/menu-controller.mjs +4 -4
  44. package/esm2020/providers/modal-controller.mjs +4 -4
  45. package/esm2020/providers/picker-controller.mjs +4 -7
  46. package/esm2020/providers/toast-controller.mjs +4 -4
  47. package/esm2020/standalone/directives/checkbox.mjs +4 -4
  48. package/esm2020/standalone/directives/datetime.mjs +4 -4
  49. package/esm2020/standalone/directives/icon.mjs +4 -4
  50. package/esm2020/standalone/directives/index.mjs +2 -1
  51. package/esm2020/standalone/directives/input.mjs +4 -4
  52. package/esm2020/standalone/directives/proxies.mjs +201 -316
  53. package/esm2020/standalone/directives/radio-group.mjs +4 -4
  54. package/esm2020/standalone/directives/radio.mjs +62 -0
  55. package/esm2020/standalone/directives/range.mjs +4 -4
  56. package/esm2020/standalone/directives/searchbar.mjs +4 -4
  57. package/esm2020/standalone/directives/segment.mjs +4 -4
  58. package/esm2020/standalone/directives/select.mjs +4 -4
  59. package/esm2020/standalone/directives/textarea.mjs +4 -4
  60. package/esm2020/standalone/directives/toggle.mjs +4 -4
  61. package/esm2020/standalone/index.mjs +2 -2
  62. package/esm2020/standalone/navigation/back-button.mjs +4 -4
  63. package/esm2020/standalone/navigation/nav.mjs +4 -4
  64. package/esm2020/standalone/navigation/router-link-delegate.mjs +7 -7
  65. package/esm2020/standalone/navigation/router-outlet.mjs +4 -4
  66. package/esm2020/standalone/navigation/tabs.mjs +4 -4
  67. package/esm2020/standalone/overlays/modal.mjs +4 -4
  68. package/esm2020/standalone/overlays/popover.mjs +4 -4
  69. package/esm2020/standalone/providers/action-sheet-controller.mjs +4 -4
  70. package/esm2020/standalone/providers/alert-controller.mjs +4 -4
  71. package/esm2020/standalone/providers/animation-controller.mjs +4 -4
  72. package/esm2020/standalone/providers/gesture-controller.mjs +4 -4
  73. package/esm2020/standalone/providers/loading-controller.mjs +4 -4
  74. package/esm2020/standalone/providers/menu-controller.mjs +4 -4
  75. package/esm2020/standalone/providers/modal-controller.mjs +4 -4
  76. package/esm2020/standalone/providers/picker-controller.mjs +5 -8
  77. package/esm2020/standalone/providers/toast-controller.mjs +4 -4
  78. package/fesm2015/ionic-angular-common.mjs +47 -47
  79. package/fesm2015/ionic-angular-common.mjs.map +1 -1
  80. package/fesm2015/ionic-angular-standalone.mjs +412 -471
  81. package/fesm2015/ionic-angular-standalone.mjs.map +1 -1
  82. package/fesm2015/ionic-angular.mjs +352 -391
  83. package/fesm2015/ionic-angular.mjs.map +1 -1
  84. package/fesm2020/ionic-angular-common.mjs +47 -47
  85. package/fesm2020/ionic-angular-common.mjs.map +1 -1
  86. package/fesm2020/ionic-angular-standalone.mjs +412 -471
  87. package/fesm2020/ionic-angular-standalone.mjs.map +1 -1
  88. package/fesm2020/ionic-angular.mjs +352 -391
  89. package/fesm2020/ionic-angular.mjs.map +1 -1
  90. package/index.d.ts +1 -0
  91. package/ionic-module.d.ts +12 -11
  92. package/package.json +2 -2
  93. package/providers/picker-controller.d.ts +1 -4
  94. package/standalone/directives/index.d.ts +1 -0
  95. package/standalone/directives/proxies.d.ts +7 -56
  96. package/standalone/directives/radio.d.ts +22 -0
  97. package/standalone/index.d.ts +1 -1
  98. package/standalone/providers/picker-controller.d.ts +1 -4
  99. package/test/apps/ng14/node_modules/@angular/animations/README.md +8 -0
  100. package/test/apps/ng14/node_modules/@angular/cli/README.md +5 -0
  101. package/test/apps/ng14/node_modules/@angular/common/README.md +8 -0
  102. package/test/apps/ng14/node_modules/@angular/compiler/README.md +8 -0
  103. package/test/apps/ng14/node_modules/@angular/core/README.md +8 -0
  104. package/test/apps/ng14/node_modules/@angular/forms/README.md +8 -0
  105. package/test/apps/ng14/node_modules/@angular/platform-browser/README.md +8 -0
  106. package/test/apps/ng14/node_modules/@angular/platform-browser-dynamic/README.md +8 -0
  107. package/test/apps/ng14/node_modules/@angular/platform-server/README.md +8 -0
  108. package/test/apps/ng14/node_modules/@angular/router/README.md +8 -0
  109. package/test/apps/ng14/node_modules/@angular-devkit/build-angular/README.md +20 -0
  110. package/test/apps/ng14/node_modules/@angular-eslint/builder/README.md +1 -0
  111. package/test/apps/ng14/node_modules/@angular-eslint/eslint-plugin/README.md +1 -0
  112. package/test/apps/ng14/node_modules/@angular-eslint/eslint-plugin-template/README.md +1 -0
  113. package/test/apps/ng14/node_modules/@angular-eslint/schematics/README.md +1 -0
  114. package/test/apps/ng14/node_modules/@angular-eslint/template-parser/README.md +1 -0
  115. package/test/apps/ng14/node_modules/@ionic/angular/README.md +74 -0
  116. package/test/apps/ng14/node_modules/@nguniversal/builders/README.md +76 -0
  117. package/test/apps/ng14/node_modules/@types/express/README.md +15 -0
  118. package/test/apps/ng14/node_modules/@types/node/README.md +16 -0
  119. package/test/apps/ng14/node_modules/@typescript-eslint/eslint-plugin/README.md +10 -0
  120. package/test/apps/ng14/node_modules/@typescript-eslint/parser/README.md +10 -0
  121. package/test/apps/ng14/node_modules/concurrently/README.md +315 -0
  122. package/test/apps/ng14/node_modules/core-js/README.md +2307 -0
  123. package/test/apps/ng14/node_modules/cypress/README.md +25 -0
  124. package/test/apps/ng14/node_modules/eslint/README.md +308 -0
  125. package/test/apps/ng14/node_modules/rxjs/README.md +107 -0
  126. package/test/apps/ng14/node_modules/ts-loader/README.md +731 -0
  127. package/test/apps/ng14/node_modules/ts-node/README.md +302 -0
  128. package/test/apps/ng14/node_modules/tslib/README.md +164 -0
  129. package/test/apps/ng14/node_modules/typescript/README.md +104 -0
  130. package/test/apps/ng14/node_modules/typescript-eslint-language-service/README.md +77 -0
  131. package/test/apps/ng14/node_modules/wait-on/README.md +297 -0
  132. package/test/apps/ng14/node_modules/webpack/README.md +721 -0
  133. package/test/apps/ng14/node_modules/webpack-cli/README.md +147 -0
  134. package/test/apps/ng14/node_modules/zone.js/README.md +141 -0
  135. package/test/apps/ng15/node_modules/@angular/animations/README.md +8 -0
  136. package/test/apps/ng15/node_modules/@angular/cli/README.md +5 -0
  137. package/test/apps/ng15/node_modules/@angular/common/README.md +8 -0
  138. package/test/apps/ng15/node_modules/@angular/compiler/README.md +8 -0
  139. package/test/apps/ng15/node_modules/@angular/core/README.md +8 -0
  140. package/test/apps/ng15/node_modules/@angular/forms/README.md +8 -0
  141. package/test/apps/ng15/node_modules/@angular/platform-browser/README.md +8 -0
  142. package/test/apps/ng15/node_modules/@angular/platform-browser-dynamic/README.md +8 -0
  143. package/test/apps/ng15/node_modules/@angular/platform-server/README.md +8 -0
  144. package/test/apps/ng15/node_modules/@angular/router/README.md +8 -0
  145. package/test/apps/ng15/node_modules/@angular-devkit/build-angular/README.md +20 -0
  146. package/test/apps/ng15/node_modules/@angular-eslint/builder/README.md +1 -0
  147. package/test/apps/ng15/node_modules/@angular-eslint/eslint-plugin/README.md +1 -0
  148. package/test/apps/ng15/node_modules/@angular-eslint/eslint-plugin-template/README.md +1 -0
  149. package/test/apps/ng15/node_modules/@angular-eslint/schematics/README.md +1 -0
  150. package/test/apps/ng15/node_modules/@angular-eslint/template-parser/README.md +1 -0
  151. package/test/apps/ng15/node_modules/@ionic/angular/README.md +74 -0
  152. package/test/apps/ng15/node_modules/@nguniversal/builders/README.md +76 -0
  153. package/test/apps/ng15/node_modules/@nguniversal/express-engine/README.md +118 -0
  154. package/test/apps/ng15/node_modules/@types/express/README.md +15 -0
  155. package/test/apps/ng15/node_modules/@types/node/README.md +16 -0
  156. package/test/apps/ng15/node_modules/@typescript-eslint/eslint-plugin/README.md +234 -0
  157. package/test/apps/ng15/node_modules/@typescript-eslint/parser/README.md +265 -0
  158. package/test/apps/ng15/node_modules/concurrently/README.md +315 -0
  159. package/test/apps/ng15/node_modules/core-js/README.md +2307 -0
  160. package/test/apps/ng15/node_modules/cypress/README.md +25 -0
  161. package/test/apps/ng15/node_modules/eslint/README.md +308 -0
  162. package/test/apps/ng15/node_modules/rxjs/README.md +107 -0
  163. package/test/apps/ng15/node_modules/ts-loader/README.md +731 -0
  164. package/test/apps/ng15/node_modules/ts-node/README.md +302 -0
  165. package/test/apps/ng15/node_modules/tslib/README.md +164 -0
  166. package/test/apps/ng15/node_modules/typescript/README.md +104 -0
  167. package/test/apps/ng15/node_modules/typescript-eslint-language-service/README.md +77 -0
  168. package/test/apps/ng15/node_modules/wait-on/README.md +297 -0
  169. package/test/apps/ng15/node_modules/webpack/README.md +721 -0
  170. package/test/apps/ng15/node_modules/webpack-cli/README.md +147 -0
  171. package/test/apps/ng15/node_modules/zone.js/README.md +141 -0
  172. package/test/apps/ng16/node_modules/@angular/animations/README.md +8 -0
  173. package/test/apps/ng16/node_modules/@angular/cli/README.md +5 -0
  174. package/test/apps/ng16/node_modules/@angular/common/README.md +8 -0
  175. package/test/apps/ng16/node_modules/@angular/compiler/README.md +8 -0
  176. package/test/apps/ng16/node_modules/@angular/core/README.md +8 -0
  177. package/test/apps/ng16/node_modules/@angular/forms/README.md +8 -0
  178. package/test/apps/ng16/node_modules/@angular/platform-browser/README.md +8 -0
  179. package/test/apps/ng16/node_modules/@angular/platform-browser-dynamic/README.md +8 -0
  180. package/test/apps/ng16/node_modules/@angular/platform-server/README.md +8 -0
  181. package/test/apps/ng16/node_modules/@angular/router/README.md +8 -0
  182. package/test/apps/ng16/node_modules/@angular-devkit/build-angular/README.md +20 -0
  183. package/test/apps/ng16/node_modules/@angular-eslint/builder/README.md +1 -0
  184. package/test/apps/ng16/node_modules/@angular-eslint/eslint-plugin/README.md +84 -0
  185. package/test/apps/ng16/node_modules/@angular-eslint/eslint-plugin-template/README.md +93 -0
  186. package/test/apps/ng16/node_modules/@angular-eslint/schematics/README.md +1 -0
  187. package/test/apps/ng16/node_modules/@angular-eslint/template-parser/README.md +1 -0
  188. package/test/apps/ng16/node_modules/@ionic/angular/README.md +74 -0
  189. package/test/apps/ng16/node_modules/@nguniversal/builders/README.md +76 -0
  190. package/test/apps/ng16/node_modules/@nguniversal/express-engine/README.md +118 -0
  191. package/test/apps/ng16/node_modules/@types/express/README.md +15 -0
  192. package/test/apps/ng16/node_modules/@types/node/README.md +16 -0
  193. package/test/apps/ng16/node_modules/@typescript-eslint/eslint-plugin/README.md +234 -0
  194. package/test/apps/ng16/node_modules/@typescript-eslint/parser/README.md +265 -0
  195. package/test/apps/ng16/node_modules/concurrently/README.md +315 -0
  196. package/test/apps/ng16/node_modules/core-js/README.md +2307 -0
  197. package/test/apps/ng16/node_modules/cypress/README.md +25 -0
  198. package/test/apps/ng16/node_modules/eslint/README.md +308 -0
  199. package/test/apps/ng16/node_modules/rxjs/README.md +107 -0
  200. package/test/apps/ng16/node_modules/ts-loader/README.md +731 -0
  201. package/test/apps/ng16/node_modules/ts-node/README.md +302 -0
  202. package/test/apps/ng16/node_modules/tslib/README.md +164 -0
  203. package/test/apps/ng16/node_modules/typescript/README.md +49 -0
  204. package/test/apps/ng16/node_modules/typescript-eslint-language-service/README.md +77 -0
  205. package/test/apps/ng16/node_modules/wait-on/README.md +297 -0
  206. package/test/apps/ng16/node_modules/webpack/README.md +721 -0
  207. package/test/apps/ng16/node_modules/webpack-cli/README.md +147 -0
  208. package/test/apps/ng16/node_modules/zone.js/README.md +141 -0
  209. package/test/apps/ng17/node_modules/@angular/animations/README.md +8 -0
  210. package/test/apps/ng17/node_modules/@angular/cli/README.md +5 -0
  211. package/test/apps/ng17/node_modules/@angular/common/README.md +8 -0
  212. package/test/apps/ng17/node_modules/@angular/compiler/README.md +8 -0
  213. package/test/apps/ng17/node_modules/@angular/core/README.md +8 -0
  214. package/test/apps/ng17/node_modules/@angular/forms/README.md +8 -0
  215. package/test/apps/ng17/node_modules/@angular/platform-browser/README.md +8 -0
  216. package/test/apps/ng17/node_modules/@angular/platform-browser-dynamic/README.md +8 -0
  217. package/test/apps/ng17/node_modules/@angular/platform-server/README.md +8 -0
  218. package/test/apps/ng17/node_modules/@angular/router/README.md +8 -0
  219. package/test/apps/ng17/node_modules/@angular-devkit/build-angular/README.md +24 -0
  220. package/test/apps/ng17/node_modules/@angular-eslint/builder/README.md +1 -0
  221. package/test/apps/ng17/node_modules/@angular-eslint/eslint-plugin/README.md +84 -0
  222. package/test/apps/ng17/node_modules/@angular-eslint/eslint-plugin-template/README.md +94 -0
  223. package/test/apps/ng17/node_modules/@angular-eslint/schematics/README.md +1 -0
  224. package/test/apps/ng17/node_modules/@angular-eslint/template-parser/README.md +1 -0
  225. package/test/apps/ng17/node_modules/@ionic/angular/README.md +74 -0
  226. package/test/apps/ng17/node_modules/@types/express/README.md +15 -0
  227. package/test/apps/ng17/node_modules/@types/ws/README.md +16 -0
  228. package/test/apps/ng17/node_modules/@typescript-eslint/eslint-plugin/README.md +12 -0
  229. package/test/apps/ng17/node_modules/@typescript-eslint/parser/README.md +12 -0
  230. package/test/apps/ng17/node_modules/concurrently/README.md +315 -0
  231. package/test/apps/ng17/node_modules/core-js/README.md +95 -0
  232. package/test/apps/ng17/node_modules/cypress/README.md +25 -0
  233. package/test/apps/ng17/node_modules/eslint/README.md +308 -0
  234. package/test/apps/ng17/node_modules/rxjs/README.md +107 -0
  235. package/test/apps/ng17/node_modules/ts-loader/README.md +731 -0
  236. package/test/apps/ng17/node_modules/ts-node/README.md +302 -0
  237. package/test/apps/ng17/node_modules/tslib/README.md +164 -0
  238. package/test/apps/ng17/node_modules/typescript/README.md +51 -0
  239. package/test/apps/ng17/node_modules/typescript-eslint-language-service/README.md +77 -0
  240. package/test/apps/ng17/node_modules/wait-on/README.md +297 -0
  241. package/test/apps/ng17/node_modules/webpack/README.md +721 -0
  242. package/test/apps/ng17/node_modules/webpack-cli/README.md +147 -0
  243. package/test/apps/ng17/node_modules/zone.js/README.md +141 -0
@@ -0,0 +1,731 @@
1
+ # TypeScript loader for webpack
2
+
3
+ [![npm version](https://img.shields.io/npm/v/ts-loader.svg)](https://www.npmjs.com/package/ts-loader)
4
+ [![Linux Build Status](https://travis-ci.org/TypeStrong/ts-loader.svg?branch=master)](https://travis-ci.org/TypeStrong/ts-loader)
5
+ [![Windows Build Status](https://ci.appveyor.com/api/projects/status/bjh0r0d4ckspgkh9/branch/master?svg=true)](https://ci.appveyor.com/project/JohnReilly/ts-loader/branch/master)
6
+ [![Downloads](http://img.shields.io/npm/dm/ts-loader.svg)](https://npmjs.org/package/ts-loader)
7
+ [![node version](https://img.shields.io/node/v/ts-loader.svg)](https://www.npmjs.com/package/ts-loader)
8
+ [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
9
+ [![Join the chat at https://gitter.im/TypeStrong/ts-loader](https://img.shields.io/badge/gitter-join%20chat-brightgreen.svg)](https://gitter.im/TypeStrong/ts-loader)
10
+
11
+ <br />
12
+ <p align="center">
13
+ <h3 align="center">ts-loader</h3>
14
+
15
+ <p align="center">
16
+ This is the TypeScript loader for webpack.
17
+ <br />
18
+ <br />
19
+ <a href="https://github.com/TypeStrong/ts-loader/issues">Installation</a>
20
+ ·
21
+ <a href="https://github.com/TypeStrong/ts-loader/issues">Report Bug</a>
22
+ ·
23
+ <a href="https://github.com/TypeStrong/ts-loader/issues">Request Feature</a>
24
+ </p>
25
+ </p>
26
+
27
+ ## Table of Contents
28
+
29
+ <!-- toc -->
30
+
31
+ - [Getting Started](#getting-started)
32
+ * [Installation](#installation)
33
+ * [Running](#running)
34
+ * [Examples](#examples)
35
+ * [Faster Builds](#faster-builds)
36
+ * [Yarn Plug’n’Play](#yarn-plugnplay)
37
+ * [Babel](#babel)
38
+ * [Parallelising Builds](#parallelising-builds)
39
+ * [Compatibility](#compatibility)
40
+ * [Configuration](#configuration)
41
+ + [`devtool` / sourcemaps](#devtool--sourcemaps)
42
+ * [Code Splitting and Loading Other Resources](#code-splitting-and-loading-other-resources)
43
+ * [Declarations (.d.ts)](#declarations-dts)
44
+ * [Failing the build on TypeScript compilation error](#failing-the-build-on-typescript-compilation-error)
45
+ * [`baseUrl` / `paths` module resolution](#baseurl--paths-module-resolution)
46
+ * [Options](#options)
47
+ * [Loader Options](#loader-options)
48
+ + [transpileOnly](#transpileonly)
49
+ + [happyPackMode](#happypackmode)
50
+ + [resolveModuleName and resolveTypeReferenceDirective](#resolvemodulename-and-resolvetypereferencedirective)
51
+ + [getCustomTransformers](#getcustomtransformers)
52
+ + [logInfoToStdOut](#loginfotostdout)
53
+ + [logLevel](#loglevel)
54
+ + [silent](#silent)
55
+ + [ignoreDiagnostics](#ignorediagnostics)
56
+ + [reportFiles](#reportfiles)
57
+ + [compiler](#compiler)
58
+ + [configFile](#configfile)
59
+ + [colors](#colors)
60
+ + [errorFormatter](#errorformatter)
61
+ + [compilerOptions](#compileroptions)
62
+ + [instance](#instance)
63
+ + [appendTsSuffixTo](#appendtssuffixto)
64
+ + [appendTsxSuffixTo](#appendtsxsuffixto)
65
+ + [onlyCompileBundledFiles](#onlycompilebundledfiles)
66
+ + [allowTsInNodeModules](#allowtsinnodemodules)
67
+ + [context](#context)
68
+ + [experimentalFileCaching](#experimentalfilecaching)
69
+ + [projectReferences](#projectreferences)
70
+ * [Usage with webpack watch](#usage-with-webpack-watch)
71
+ * [Hot Module replacement](#hot-module-replacement)
72
+ - [Contributing](#contributing)
73
+ - [License](#license)
74
+
75
+ <!-- tocstop -->
76
+
77
+ ## Getting Started
78
+
79
+ ### Installation
80
+
81
+ ```
82
+ yarn add ts-loader --dev
83
+ ```
84
+
85
+ or
86
+
87
+ ```
88
+ npm install ts-loader --save-dev
89
+ ```
90
+
91
+ You will also need to install TypeScript if you have not already.
92
+
93
+ ```
94
+ yarn add typescript --dev
95
+ ```
96
+
97
+ or
98
+
99
+ ```
100
+ npm install typescript --save-dev
101
+ ```
102
+
103
+ ### Running
104
+
105
+ Use webpack like normal, including `webpack --watch` and `webpack-dev-server`, or through another
106
+ build system using the [Node.js API](http://webpack.github.io/docs/node.js-api.html).
107
+
108
+ ### Examples
109
+
110
+ We have a number of example setups to accommodate different workflows. Our examples can be found [here](examples/).
111
+
112
+ We probably have more examples than we need. That said, here's a good way to get started:
113
+
114
+ - I want the simplest setup going. Use "[vanilla](examples/vanilla)" `ts-loader`
115
+ - I want the fastest compilation that's available. Use [fork-ts-checker-webpack-plugin](https://github.com/Realytics/fork-ts-checker-webpack-plugin). It performs type checking in a separate process with `ts-loader` just handling transpilation.
116
+
117
+ ### Faster Builds
118
+
119
+ As your project becomes bigger, compilation time increases linearly. It's because typescript's semantic checker has to inspect all files on every rebuild. The simple solution is to disable it by using the `transpileOnly: true` option, but doing so leaves you without type checking and *will not output declaration files*.
120
+
121
+ You probably don't want to give up type checking; that's rather the point of TypeScript. So what you can do is use the [fork-ts-checker-webpack-plugin](https://github.com/Realytics/fork-ts-checker-webpack-plugin). It runs the type checker on a separate process, so your build remains fast thanks to `transpileOnly: true` but you still have the type checking. Also, the plugin has several optimizations to make incremental type checking faster (AST cache, multiple workers).
122
+
123
+ If you'd like to see a simple setup take a look at [our simple example](examples/fork-ts-checker-webpack-plugin/). For a more complex setup take a look at our [more involved example](examples/react-babel-karma-gulp).
124
+
125
+ ### Yarn Plug’n’Play
126
+
127
+ `ts-loader` supports [Yarn Plug’n’Play](https://yarnpkg.com/en/docs/pnp). The recommended way to integrate is using the [pnp-webpack-plugin](https://github.com/arcanis/pnp-webpack-plugin#ts-loader-integration).
128
+
129
+ ### Babel
130
+
131
+ `ts-loader` works very well in combination with [babel](https://babeljs.io/) and [babel-loader](https://github.com/babel/babel-loader). There is an [example](https://github.com/Microsoft/TypeScriptSamples/tree/master/react-flux-babel-karma) of this in the official [TypeScript Samples](https://github.com/Microsoft/TypeScriptSamples). Alternatively take a look at our own [example](examples/react-babel-karma-gulp).
132
+
133
+ ### Parallelising Builds
134
+
135
+ It's possible to parallelise your builds. Historically this was useful from a performance perspective with webpack 2 / 3. [With webpack 4+ there appears to be significantly less benefit and perhaps even cost.](https://blog.johnnyreilly.com/2018/12/you-might-not-need-thread-loader.html)
136
+
137
+ But if that's what you want to do, there's two ways to achieve this: [happypack](https://github.com/amireh/happypack) and [thread-loader](https://github.com/webpack-contrib/thread-loader). Both should be used in combination with [fork-ts-checker-webpack-plugin](https://github.com/Realytics/fork-ts-checker-webpack-plugin) for typechecking.)
138
+
139
+ To read more, look at [this post](https://medium.com/webpack/typescript-webpack-super-pursuit-mode-83cc568dea79) by [@johnny_reilly](https://twitter.com/johnny_reilly) on the webpack publication channel.
140
+
141
+ If you'd like find out further ways to improve your build using the watch API then take a look at [this post](https://medium.com/@kenneth_chau/speeding-up-webpack-typescript-incremental-builds-by-7x-3912ba4c1d15) by [@kenneth_chau](https://twitter.com/kenneth_chau).
142
+
143
+ ### Compatibility
144
+
145
+ * TypeScript: 2.4.1+
146
+ * webpack: 4.x+ (please use `ts-loader` 3.x if you need webpack 2 or 3 support)
147
+ * node: 6.11.5 minimum (aligned with webpack 4)
148
+
149
+ A full test suite runs each night (and on each pull request). It runs both on [Linux](https://travis-ci.org/TypeStrong/ts-loader) and [Windows](https://ci.appveyor.com/project/JohnReilly/ts-loader), testing `ts-loader` against major releases of TypeScript. The test suite also runs against TypeScript@next (because we want to use it as much as you do).
150
+
151
+ If you become aware of issues not caught by the test suite then please let us know. Better yet, write a test and submit it in a PR!
152
+
153
+ ### Configuration
154
+
155
+ 1. Create or update `webpack.config.js` like so:
156
+
157
+ ```javascript
158
+ module.exports = {
159
+ mode: "development",
160
+ devtool: "inline-source-map",
161
+ entry: "./app.ts",
162
+ output: {
163
+ filename: "bundle.js"
164
+ },
165
+ resolve: {
166
+ // Add `.ts` and `.tsx` as a resolvable extension.
167
+ extensions: [".ts", ".tsx", ".js"]
168
+ },
169
+ module: {
170
+ rules: [
171
+ // all files with a `.ts` or `.tsx` extension will be handled by `ts-loader`
172
+ { test: /\.tsx?$/, loader: "ts-loader" }
173
+ ]
174
+ }
175
+ };
176
+ ```
177
+
178
+ 2. Add a [`tsconfig.json`](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) file. (The one below is super simple; but you can tweak this to your hearts desire)
179
+
180
+ ```json
181
+ {
182
+ "compilerOptions": {
183
+ "sourceMap": true
184
+ }
185
+ }
186
+ ```
187
+
188
+ The [tsconfig.json](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html) file controls
189
+ TypeScript-related options so that your IDE, the `tsc` command, and this loader all share the
190
+ same options.
191
+
192
+ #### `devtool` / sourcemaps
193
+
194
+ If you want to be able to debug your original source then you can thanks to the magic of sourcemaps. There are 2 steps to getting this set up with `ts-loader` and webpack.
195
+
196
+ First, for `ts-loader` to produce **sourcemaps**, you will need to set the [tsconfig.json](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html) option as `"sourceMap": true`.
197
+
198
+ Second, you need to set the `devtool` option in your `webpack.config.js` to support the type of sourcemaps you want. To make your choice have a read of the [`devtool` webpack docs](https://webpack.js.org/configuration/devtool/). You may be somewhat daunted by the choice available. You may also want to vary the sourcemap strategy depending on your build environment. Here are some example strategies for different environments:
199
+
200
+ * `devtool: 'inline-source-map'` - Solid sourcemap support; the best "all-rounder". Works well with karma-webpack (not all strategies do)
201
+ * `devtool: 'cheap-module-eval-source-map'` - Best support for sourcemaps whilst debugging.
202
+ * `devtool: 'source-map'` - Approach that plays well with UglifyJsPlugin; typically you might use this in Production
203
+
204
+ ### Code Splitting and Loading Other Resources
205
+
206
+ Loading css and other resources is possible but you will need to make sure that
207
+ you have defined the `require` function in a [declaration file](https://www.typescriptlang.org/docs/handbook/writing-declaration-files.html).
208
+
209
+ ```typescript
210
+ declare var require: {
211
+ <T>(path: string): T;
212
+ (paths: string[], callback: (...modules: any[]) => void): void;
213
+ ensure: (
214
+ paths: string[],
215
+ callback: (require: <T>(path: string) => T) => void
216
+ ) => void;
217
+ };
218
+ ```
219
+
220
+ Then you can simply require assets or chunks per the [webpack documentation](https://webpack.js.org/guides/code-splitting/).
221
+
222
+ ```javascript
223
+ require("!style!css!./style.css");
224
+ ```
225
+
226
+ The same basic process is required for code splitting. In this case, you `import` modules you need but you
227
+ don't directly use them. Instead you require them at [split points](http://webpack.github.io/docs/code-splitting.html#defining-a-split-point). See [this example](test/comparison-tests/codeSplitting) and [this example](test/comparison-tests/es6codeSplitting) for more details.
228
+
229
+ [TypeScript 2.4 provides support for ECMAScript's new `import()` calls. These calls import a module and return a promise to that module.](https://blogs.msdn.microsoft.com/typescript/2017/06/12/announcing-typescript-2-4-rc/) This is also supported in webpack - details on usage can be found [here](https://webpack.js.org/guides/code-splitting-async/#dynamic-import-import-). Happy code splitting!
230
+
231
+ ### Declarations (.d.ts)
232
+
233
+ To output a built .d.ts file, you can set `"declaration": true` in your tsconfig, and use the [DeclarationBundlerPlugin](https://www.npmjs.com/package/declaration-bundler-webpack-plugin) in your webpack config.
234
+
235
+ ### Failing the build on TypeScript compilation error
236
+
237
+ The build **should** fail on TypeScript compilation errors as of webpack 2. If for some reason it does not, you can use the [webpack-fail-plugin](https://www.npmjs.com/package/webpack-fail-plugin).
238
+
239
+ For more background have a read of [this issue](https://github.com/TypeStrong/ts-loader/issues/108).
240
+
241
+ ### `baseUrl` / `paths` module resolution
242
+
243
+ If you want to resolve modules according to `baseUrl` and `paths` in your `tsconfig.json` then you can use the [tsconfig-paths-webpack-plugin](https://www.npmjs.com/package/tsconfig-paths-webpack-plugin) package. For details about this functionality, see the [module resolution documentation](https://www.typescriptlang.org/docs/handbook/module-resolution.html#base-url).
244
+
245
+ This feature requires webpack 2.1+ and TypeScript 2.0+. Use the config below or check the [package](https://github.com/dividab/tsconfig-paths-webpack-plugin/blob/master/README.md) for more information on usage.
246
+
247
+ ```javascript
248
+ const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
249
+
250
+ module.exports = {
251
+ ...
252
+ resolve: {
253
+ plugins: [new TsconfigPathsPlugin({ /*configFile: "./path/to/tsconfig.json" */ })]
254
+ }
255
+ ...
256
+ }
257
+ ```
258
+
259
+ ### Options
260
+
261
+ There are two types of options: TypeScript options (aka "compiler options") and loader options. TypeScript options should be set using a tsconfig.json file. Loader options can be specified through the `options` property in the webpack configuration:
262
+
263
+ ```javascript
264
+ module.exports = {
265
+ ...
266
+ module: {
267
+ rules: [
268
+ {
269
+ test: /\.tsx?$/,
270
+ use: [
271
+ {
272
+ loader: 'ts-loader',
273
+ options: {
274
+ transpileOnly: true
275
+ }
276
+ }
277
+ ]
278
+ }
279
+ ]
280
+ }
281
+ }
282
+ ```
283
+
284
+ ### Loader Options
285
+
286
+ #### transpileOnly
287
+ | Type | Default Value |
288
+ |------|--------------|
289
+ | `boolean` | `false`|
290
+
291
+ If you want to speed up compilation significantly you can set this flag.
292
+ However, many of the benefits you get from static type checking between
293
+ different dependencies in your application will be lost.
294
+
295
+ It's advisable to use `transpileOnly` alongside the [fork-ts-checker-webpack-plugin](https://github.com/Realytics/fork-ts-checker-webpack-plugin) to get full type checking again. To see what this looks like in practice then either take a look at [our simple example](examples/fork-ts-checker-webpack-plugin). For a more complex setup take a look at our [more involved example](examples/react-babel-karma-gulp).
296
+
297
+ If you enable this option, webpack 4 will give you "export not found" warnings any time you re-export a type:
298
+
299
+ ```
300
+ WARNING in ./src/bar.ts
301
+ 1:0-34 "export 'IFoo' was not found in './foo'
302
+ @ ./src/bar.ts
303
+ @ ./src/index.ts
304
+ ```
305
+
306
+ The reason this happens is that when typescript doesn't do a full type check, it does not have enough information to determine whether an imported name is a type or not, so when the name is then exported, typescript has no choice but to emit the export. Fortunately, the extraneous export should not be harmful, so you can just suppress these warnings:
307
+
308
+ ```javascript
309
+ module.exports = {
310
+ ...
311
+ stats: {
312
+ warningsFilter: /export .* was not found in/
313
+ }
314
+ }
315
+ ```
316
+
317
+ #### happyPackMode
318
+ | Type | Default Value |
319
+ |------|--------------|
320
+ | `boolean` | `false`|
321
+
322
+ If you're using [HappyPack](https://github.com/amireh/happypack) or [thread-loader](https://github.com/webpack-contrib/thread-loader) to parallise your builds then you'll need to set this to `true`. This implicitly sets `*transpileOnly*` to `true` and **WARNING!** stops registering **_all_** errors to webpack.
323
+
324
+ It's advisable to use this with the [fork-ts-checker-webpack-plugin](https://github.com/Realytics/fork-ts-checker-webpack-plugin) to get full type checking again. To see what this looks like in practice then either take a look at [our simple thread-loader example](examples/thread-loader). **_IMPORTANT_**: If you are using fork-ts-checker-webpack-plugin alongside HappyPack or thread-loader then ensure you set the `checkSyntacticErrors` option like so:
325
+
326
+ ```javascript
327
+ new ForkTsCheckerWebpackPlugin({ checkSyntacticErrors: true })
328
+ ```
329
+
330
+ This will ensure that the plugin checks for both syntactic errors (eg `const array = [{} {}];`) and semantic errors (eg `const x: number = '1';`). By default the plugin only checks for semantic errors (as when used with `ts-loader` in `transpileOnly` mode, `ts-loader` will still report syntactic errors).
331
+
332
+ Also, if you are using `thread-loader` in watch mode, remember to set `poolTimeout: Infinity` so workers don't die.
333
+
334
+ #### resolveModuleName and resolveTypeReferenceDirective
335
+
336
+ These options should be functions which will be used to resolve the import statements and the `<reference types="...">` directives instead of the default TypeScript implementation. It's not intended that these will typically be used by a user of `ts-loader` - they exist to facilitate functionality such as [Yarn Plug’n’Play](https://yarnpkg.com/en/docs/pnp).
337
+
338
+ #### getCustomTransformers
339
+ | Type |
340
+ |------|
341
+ | ` (program: Program) => { before?: TransformerFactory<SourceFile>[]; after?: TransformerFactory<SourceFile>[]; } ` |
342
+
343
+ Provide custom transformers - only compatible with TypeScript 2.3+ (and 2.4 if using `transpileOnly` mode). For example usage take a look at [typescript-plugin-styled-components](https://github.com/Igorbek/typescript-plugin-styled-components) or our [test](test/comparison-tests/customTransformer).
344
+
345
+ You can also pass a path string to locate a js module file which exports the function described above, this useful especially in `happyPackMode`. (Because forked processes cannot serialize functions see more at [related issue](https://github.com/Igorbek/typescript-plugin-styled-components/issues/6#issue-303387183))
346
+
347
+ #### logInfoToStdOut
348
+ | Type | Default Value |
349
+ |------|--------------|
350
+ | `boolean` | `false`|
351
+
352
+ This is important if you read from stdout or stderr and for proper error handling.
353
+ The default value ensures that you can read from stdout e.g. via pipes or you use webpack -j to generate json output.
354
+
355
+ #### logLevel
356
+ | Type | Default Value |
357
+ |------|--------------|
358
+ | `string` | `warn` |
359
+
360
+ Can be `info`, `warn` or `error` which limits the log output to the specified log level.
361
+ Beware of the fact that errors are written to stderr and everything else is written to stderr (or stdout if logInfoToStdOut is true).
362
+
363
+ #### silent
364
+ | Type | Default Value |
365
+ |------|--------------|
366
+ | `boolean` | `false`|
367
+
368
+ If `true`, no console.log messages will be emitted. Note that most error
369
+ messages are emitted via webpack which is not affected by this flag.
370
+
371
+ #### ignoreDiagnostics
372
+ | Type | Default Value |
373
+ |------|--------------|
374
+ | `number[]` | `[]`|
375
+
376
+ You can squelch certain TypeScript errors by specifying an array of diagnostic
377
+ codes to ignore.
378
+
379
+ #### reportFiles
380
+ | Type | Default Value |
381
+ |------|--------------|
382
+ | `string[]` | `[]`|
383
+
384
+ Only report errors on files matching these glob patterns.
385
+
386
+ ```javascript
387
+ // in webpack.config.js
388
+ {
389
+ test: /\.ts$/,
390
+ loader: 'ts-loader',
391
+ options: { reportFiles: ['src/**/*.{ts,tsx}', '!src/skip.ts'] }
392
+ }
393
+ ```
394
+
395
+ This can be useful when certain types definitions have errors that are not fatal to your application.
396
+
397
+ #### compiler
398
+ | Type | Default Value |
399
+ |------|--------------|
400
+ | `string` | `'typescript'`|
401
+
402
+ Allows use of TypeScript compilers other than the official one. Should be
403
+ set to the NPM name of the compiler, eg [`ntypescript`](https://github.com/basarat/ntypescript).
404
+
405
+ #### configFile
406
+ | Type | Default Value |
407
+ |------|--------------|
408
+ | `string` | `'tsconfig.json'`|
409
+
410
+ Allows you to specify where to find the TypeScript configuration file.
411
+
412
+ You may provide
413
+
414
+ * just a file name. The loader then will search for the config file of each entry point in the respective entry point's containing folder. If a config file cannot be found there, it will travel up the parent directory chain and look for the config file in those folders.
415
+ * a relative path to the configuration file. It will be resolved relative to the respective `.ts` entry file.
416
+ * an absolute path to the configuration file.
417
+
418
+ Please note, that if the configuration file is outside of your project directory, you might need to set the `context` option to avoid TypeScript issues (like TS18003).
419
+ In this case the `configFile` should point to the `tsconfig.json` and `context` to the project root.
420
+
421
+ #### colors
422
+ | Type | Default Value |
423
+ |------|--------------|
424
+ | `boolean` | `true`|
425
+
426
+ If `false`, disables built-in colors in logger messages.
427
+
428
+ #### errorFormatter
429
+ | Type | Default Value |
430
+ |------|--------------|
431
+ | `(message: ErrorInfo, colors: boolean) => string` | `undefined`|
432
+
433
+ By default `ts-loader` formats TypeScript compiler output for an error or a warning in the style:
434
+
435
+ ```
436
+ [tsl] ERROR in myFile.ts(3,14)
437
+ TS4711: you did something very wrong
438
+ ```
439
+
440
+ If that format is not to your taste you can supply your own formatter using the `errorFormatter` option. Below is a template for a custom error formatter. Please note that the `colors` parameter is an instance of [`chalk`](https://github.com/chalk/chalk) which you can use to color your output. (This instance will respect the `colors` option.)
441
+
442
+ ```javascript
443
+ function customErrorFormatter(error, colors) {
444
+ const messageColor =
445
+ error.severity === "warning" ? colors.bold.yellow : colors.bold.red;
446
+ return (
447
+ "Does not compute.... " +
448
+ messageColor(Object.keys(error).map(key => `${key}: ${error[key]}`))
449
+ );
450
+ }
451
+ ```
452
+
453
+ If the above formatter received an error like this:
454
+
455
+ ```json
456
+ {
457
+ "code":2307,
458
+ "severity": "error",
459
+ "content": "Cannot find module 'components/myComponent2'.",
460
+ "file":"/.test/errorFormatter/app.ts",
461
+ "line":2,
462
+ "character":31
463
+ }
464
+ ```
465
+
466
+ It would produce an error message that said:
467
+
468
+ ```
469
+ Does not compute.... code: 2307,severity: error,content: Cannot find module 'components/myComponent2'.,file: /.test/errorFormatter/app.ts,line: 2,character: 31
470
+ ```
471
+
472
+ And the bit after "Does not compute.... " would be red.
473
+
474
+ #### compilerOptions
475
+ | Type | Default Value |
476
+ |------|--------------|
477
+ | `object` | `{}`|
478
+
479
+ Allows overriding TypeScript options. Should be specified in the same format
480
+ as you would do for the `compilerOptions` property in tsconfig.json.
481
+
482
+ #### instance
483
+ | Type | Default Value |
484
+ |------|--------------|
485
+ | `string` | `TODO`|
486
+
487
+ Advanced option to force files to go through different instances of the
488
+ TypeScript compiler. Can be used to force segregation between different parts
489
+ of your code.
490
+
491
+ #### appendTsSuffixTo
492
+ | Type | Default Value |
493
+ |------|--------------|
494
+ | `RegExp[]` | `[]`|
495
+
496
+ #### appendTsxSuffixTo
497
+ | Type | Default Value |
498
+ |------|--------------|
499
+ | `RegExp[]` | `[]`|
500
+
501
+ A list of regular expressions to be matched against filename. If filename matches one of the regular expressions, a `.ts` or `.tsx` suffix will be appended to that filename.
502
+
503
+ This is useful for `*.vue` [file format](https://vuejs.org/v2/guide/single-file-components.html) for now. (Probably will benefit from the new single file format in the future.)
504
+
505
+ Example:
506
+
507
+ webpack.config.js:
508
+
509
+ ```javascript
510
+ module.exports = {
511
+ entry: "./index.vue",
512
+ output: { filename: "bundle.js" },
513
+ resolve: {
514
+ extensions: [".ts", ".vue"]
515
+ },
516
+ module: {
517
+ rules: [
518
+ { test: /\.vue$/, loader: "vue-loader" },
519
+ {
520
+ test: /\.ts$/,
521
+ loader: "ts-loader",
522
+ options: { appendTsSuffixTo: [/\.vue$/] }
523
+ }
524
+ ]
525
+ }
526
+ };
527
+ ```
528
+
529
+ index.vue
530
+
531
+ ```vue
532
+ <template><p>hello {{msg}}</p></template>
533
+ <script lang="ts">
534
+ export default {
535
+ data(): Object {
536
+ return {
537
+ msg: "world"
538
+ };
539
+ }
540
+ };
541
+ </script>
542
+ ```
543
+
544
+ We can handle `.tsx` by quite similar way:
545
+
546
+ webpack.config.js:
547
+
548
+ ```javascript
549
+ module.exports = {
550
+ entry: './index.vue',
551
+ output: { filename: 'bundle.js' },
552
+ resolve: {
553
+ extensions: ['.ts', '.tsx', '.vue', '.vuex']
554
+ },
555
+ module: {
556
+ rules: [
557
+ { test: /\.vue$/, loader: 'vue-loader',
558
+ options: {
559
+ loaders: {
560
+ ts: 'ts-loader',
561
+ tsx: 'babel-loader!ts-loader',
562
+ }
563
+ }
564
+ },
565
+ { test: /\.ts$/, loader: 'ts-loader', options: { appendTsSuffixTo: [/TS\.vue$/] } }
566
+ { test: /\.tsx$/, loader: 'babel-loader!ts-loader', options: { appendTsxSuffixTo: [/TSX\.vue$/] } }
567
+ ]
568
+ }
569
+ }
570
+ ```
571
+
572
+ tsconfig.json (set `jsx` option to `preserve` to let babel handle jsx)
573
+
574
+ ```json
575
+ {
576
+ "compilerOptions": {
577
+ "jsx": "preserve"
578
+ }
579
+ }
580
+ ```
581
+
582
+ index.vue
583
+
584
+ ```vue
585
+ <script lang="tsx">
586
+ export default {
587
+ functional: true,
588
+ render(h, c) {
589
+ return (<div>Content</div>);
590
+ }
591
+ }
592
+ </script>
593
+ ```
594
+
595
+ Or if you want to use only tsx, just use the `appendTsxSuffixTo` option only:
596
+
597
+ ```javascript
598
+ { test: /\.ts$/, loader: 'ts-loader' }
599
+ { test: /\.tsx$/, loader: 'babel-loader!ts-loader', options: { appendTsxSuffixTo: [/\.vue$/] } }
600
+ ```
601
+
602
+ #### onlyCompileBundledFiles
603
+ | Type | Default Value |
604
+ |------|--------------|
605
+ | `boolean` | `false`|
606
+
607
+ The default behavior of `ts-loader` is to act as a drop-in replacement for the `tsc` command,
608
+ so it respects the `include`, `files`, and `exclude` options in your `tsconfig.json`, loading
609
+ any files specified by those options. The `onlyCompileBundledFiles` option modifies this behavior,
610
+ loading only those files that are actually bundled by webpack, as well as any `.d.ts` files included
611
+ by the `tsconfig.json` settings. `.d.ts` files are still included because they may be needed for
612
+ compilation without being explicitly imported, and therefore not picked up by webpack.
613
+
614
+ #### allowTsInNodeModules
615
+ | Type | Default Value |
616
+ |------|--------------|
617
+ | `boolean` | `false`|
618
+
619
+ By default, `ts-loader` will not compile `.ts` files in `node_modules`.
620
+ You should not need to recompile `.ts` files there, but if you really want to, use this option.
621
+ Note that this option acts as a *whitelist* - any modules you desire to import must be included in
622
+ the `"files"` or `"include"` block of your project's `tsconfig.json`.
623
+
624
+ See: [https://github.com/Microsoft/TypeScript/issues/12358](https://github.com/Microsoft/TypeScript/issues/12358)
625
+
626
+ ```javascript
627
+ // in webpack.config.js
628
+ {
629
+ test: /\.ts$/,
630
+ loader: 'ts-loader',
631
+ options: { allowTsInNodeModules: true }
632
+ }
633
+ ```
634
+
635
+ And in your `tsconfig.json`:
636
+
637
+ ```json
638
+ {
639
+ "include": [
640
+ "node_modules/whitelisted_module.ts"
641
+ ],
642
+ "files": [
643
+ "node_modules/my_module/whitelisted_file.ts"
644
+ ]
645
+ }
646
+ ```
647
+
648
+ #### context
649
+ | Type | Default Value |
650
+ |------|--------------|
651
+ | `string` | `undefined`|
652
+
653
+ If set, will parse the TypeScript configuration file with given **absolute path** as base path.
654
+ Per default the directory of the configuration file is used as base path. Relative paths in the configuration
655
+ file are resolved with respect to the base path when parsed. Option `context` allows to set option
656
+ `configFile` to a path other than the project root (e.g. a NPM package), while the base path for `ts-loader`
657
+ can remain the project root.
658
+
659
+ Keep in mind that **not** having a `tsconfig.json` in your project root can cause different behaviour between `ts-loader` and `tsc`.
660
+ When using editors like `VS Code` it is advised to add a `tsconfig.json` file to the root of the project and extend the config file
661
+ referenced in option `configFile`. For more information please [read the PR](https://github.com/TypeStrong/ts-loader/pull/681) that
662
+ is the base and [read the PR](https://github.com/TypeStrong/ts-loader/pull/688) that contributed this option.
663
+
664
+ webpack:
665
+
666
+ ```javascript
667
+ {
668
+ loader: require.resolve('ts-loader'),
669
+ options: {
670
+ context: __dirname,
671
+ configFile: require.resolve('ts-config-react-app')
672
+ }
673
+ }
674
+ ```
675
+
676
+ Extending `tsconfig.json`:
677
+
678
+ ```json
679
+ { "extends": "./node_modules/ts-config-react-app/index" }
680
+ ```
681
+
682
+ Note that changes in the extending file while not be respected by `ts-loader`. Its purpose is to satisfy the code editor.
683
+
684
+ #### experimentalFileCaching
685
+ | Type | Default Value |
686
+ |------|--------------|
687
+ | `boolean` | `true`|
688
+
689
+ By default whenever the TypeScript compiler needs to check that a file/directory exists or resolve symlinks it makes syscalls. It does not cache the result of these operations and this may result in many syscalls with the same arguments ([see comment](https://github.com/TypeStrong/ts-loader/issues/825#issue-354725524) with example).
690
+ In some cases it may produce performance degradation.
691
+
692
+ This flag enables caching for some FS-functions like `fileExists`, `realpath` and `directoryExists` for TypeScript compiler. Note that caches are cleared between compilations.
693
+
694
+ #### projectReferences
695
+ | Type | Default Value |
696
+ |------|--------------|
697
+ | `boolean` | `false`|
698
+
699
+ ts-loader has opt-in support for [project references](https://www.typescriptlang.org/docs/handbook/project-references.html). With this configuration option enabled, `ts-loader` will incrementally rebuild upstream projects the same way `tsc --build` does. Otherwise, source files in referenced projects will be treated as if they’re part of the root project.
700
+
701
+ ### Usage with webpack watch
702
+
703
+ Because TS will generate .js and .d.ts files, you should ignore these files, otherwise watchers may go into an infinite watch loop. For example, when using webpack, you may wish to add this to your webpack.conf.js file:
704
+
705
+ ```javascript
706
+ plugins: [
707
+ new webpack.WatchIgnorePlugin([
708
+ /\.js$/,
709
+ /\.d\.ts$/
710
+ ])
711
+ ],
712
+ ```
713
+
714
+ It's worth noting that use of the `LoaderOptionsPlugin` is [only supposed to be a stopgap measure](https://webpack.js.org/plugins/loader-options-plugin/). You may want to look at removing it entirely.
715
+
716
+ ### Hot Module replacement
717
+
718
+ We do not support HMR as we did not yet work out a reliable way how to set it up.
719
+
720
+ If you want to give `webpack-dev-server` HMR a try, follow the official [webpack HMR guide](https://webpack.js.org/guides/hot-module-replacement/), then tweak a few config options for `ts-loader`:
721
+
722
+ 1. Set `transpileOnly` to `true` (see [transpileOnly](#transpileonly) for config details and recommendations above).
723
+ 2. Inside your HMR acceptance callback function, maybe re-require the module that was replaced.
724
+
725
+ ## Contributing
726
+
727
+ This is your TypeScript loader! We want you to help make it even better. Please feel free to contribute; see the [contributor's guide](CONTRIBUTING.md) to get started.
728
+
729
+ ## License
730
+
731
+ MIT License