Skip to content

Commit 32c98e4

Browse files
committed
feat(ts-config-webpack-plugin): Increase incremental type checking performance with useTypescriptIncrementalApi
fixes #39
1 parent 9cba7d7 commit 32c98e4

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

packages/ts-config-webpack-plugin/config/development.config.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
44

55
const cpus = os.cpus().length;
66

7-
// we use <max> - 2 workers for quadcore cpus and higher, two cpus are reserved
8-
// for the ts checker plugin (which at least needs one).
9-
const tsLoaderWorkers = cpus > 3 ? cpus - 2 : 1;
10-
const forkTsCheckerWorkers = Math.max(1, cpus - tsLoaderWorkers);
7+
// we use <max> - 1 workers for tricore cpus and higher, one cpu will be preserved
8+
const tsLoaderWorkers = cpus > 2 ? cpus - 1 : 1;
119

1210
/**
1311
* Common Development Config
@@ -65,12 +63,17 @@ exports = module.exports = (options) => ({
6563
new ForkTsCheckerWebpackPlugin({
6664
// don't block webpack's emit to wait for type checker, errors only visible inside CLI
6765
async: true,
68-
// increase performance on multicore systems
69-
workers: forkTsCheckerWorkers,
7066
// checkSyntacticErrors is required as we use happyPackMode and the thread-loader to parallelise the builds
7167
checkSyntacticErrors: true,
7268
// Set the tsconfig.json path
7369
tsconfig: options.configFile,
70+
// Make use of a new API comming with TypeScript 2.7
71+
// which allows to speed up the type checking
72+
// https://github.com/namics/webpack-config-plugins/issues/39
73+
useTypescriptIncrementalApi: true,
74+
// To allow using this plugin even if there is no .ts or .tsx file
75+
// ignore "TS18003: No inputs were found in config file"
76+
ignoreDiagnostics: [18003],
7477
}),
7578
],
7679
});

packages/ts-config-webpack-plugin/config/production.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ exports = module.exports = (options) => ({
6868
checkSyntacticErrors: true,
6969
// Set the tsconfig.json path
7070
tsconfig: options.configFile,
71+
// To allow using this plugin even if there is no .ts or .tsx file
72+
// ignore "TS18003: No inputs were found in config file"
73+
ignoreDiagnostics: [18003],
7174
}),
7275
],
7376
});

packages/ts-config-webpack-plugin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
},
6161
"dependencies": {
6262
"cache-loader": "^1.2.2",
63-
"fork-ts-checker-webpack-plugin": "^0.5.2",
63+
"fork-ts-checker-webpack-plugin": "1.0.0-alpha.3",
6464
"thread-loader": "^2.1.0",
6565
"ts-loader": "^5.3.1",
6666
"tslint": "^5.12.0"

0 commit comments

Comments
 (0)