You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-7Lines changed: 14 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,11 +62,14 @@ module.exports = {
62
62
};
63
63
```
64
64
65
-
If you are using **TypeScript >= 3.8.0**, it's recommended to set `"importsNotUsedAsValues": "preserve"`[compiler option](https://www.typescriptlang.org/docs/handbook/compiler-options.html)
66
-
in the `tsconfig.json`. [Here is an explanation.](#type-only-modules-watching)
65
+
If you are using **TypeScript >= 3.8.0**, it's recommended to:
66
+
* for `ts-loader` set `"importsNotUsedAsValues": "preserve"`[compiler option](https://www.typescriptlang.org/docs/handbook/compiler-options.html) in the [`tsconfig.json`](./examples/ts-loader/tsconfig.json)
67
+
* for `babel-loader` set `"onlyRemoveTypeImports": true`[preset option](https://babeljs.io/docs/en/babel-preset-typescript#onlyremovetypeimports) in the [babel configuration](./examples/babel-loader/.babelrc.js)
67
68
68
-
> You can find examples how to configure it with [babel-loader](https://github.com/babel/babel-loader), [ts-loader](https://github.com/TypeStrong/ts-loader),
69
-
> [eslint](https://github.com/eslint/eslint) and [Visual Studio Code](https://code.visualstudio.com/) in the
69
+
[Read more](#type-only-modules-watching) about type-only modules watching.
70
+
71
+
> Examples how to configure it with [babel-loader](https://github.com/babel/babel-loader), [ts-loader](https://github.com/TypeStrong/ts-loader),
72
+
> [eslint](https://github.com/eslint/eslint) and [Visual Studio Code](https://code.visualstudio.com/) are in the
70
73
> [**examples**](./examples) directory.
71
74
72
75
## Modules resolution
@@ -312,10 +315,14 @@ declare module "*.vue" {
312
315
313
316
## Type-Only modules watching
314
317
315
-
At present there is an issue with the `transpileOnly` mode regarding the triggering of type-checking when a change is made in a source file that will not emit js.
316
-
If you have a file that contains only `interface`s and/or `type`s then, by default, changes to it will **not** trigger the type checker whilst in watch mode.
318
+
At present `ts-loader` with `transpileOnly` mode and `babel-loader` will not add type-only files (files that contains only interfaces and/or types)
319
+
to the webpack dependencies set. Webpack watches only files that are in the dependencies set. This means that
320
+
changes in type-only files will **not** trigger new compilation and therefore type-checker in watch mode.
321
+
322
+
If you use **TypeScript >=3.8.0**, you can fix it:
323
+
* for `ts-loader` set `"importsNotUsedAsValues": "preserve"`[compiler option](https://www.typescriptlang.org/docs/handbook/compiler-options.html) in the [`tsconfig.json`](./examples/ts-loader/tsconfig.json)
324
+
* for `babel-loader` set `"onlyRemoveTypeImports": true`[preset option](https://babeljs.io/docs/en/babel-preset-typescript#onlyremovetypeimports) in the [babel configuration](./examples/babel-loader/.babelrc.js)
317
325
318
-
If you use **TypeScript >=3.8.0**, you can fix it by passing `"importsNotUsedAsValues": "preserve"` option to the compiler options in the `tsconfig.json`.
0 commit comments