Skip to content

Commit

Permalink
feat(ts-config-webpack-plugin): Increase incremental type checking pe…
Browse files Browse the repository at this point in the history
…rformance with `useTypescriptIncrementalApi`

fixes #39
  • Loading branch information
jantimon committed Jan 18, 2019
1 parent 9cba7d7 commit e4a6ed8
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 9 deletions.
1 change: 1 addition & 0 deletions packages/common-config-webpack-plugin/.node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.10.0
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"compilerOptions": {
"sourceMap": true,
"skipLibCheck": true,
"suppressOutputPathCheck": true
"skipLibCheck": true
}
}
7 changes: 7 additions & 0 deletions packages/scss-config-webpack-plugin/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"declaration": true,
"rootDir": "./"
}
}
15 changes: 9 additions & 6 deletions packages/ts-config-webpack-plugin/config/development.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');

const cpus = os.cpus().length;

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

/**
* Common Development Config
Expand Down Expand Up @@ -65,12 +63,17 @@ exports = module.exports = (options) => ({
new ForkTsCheckerWebpackPlugin({
// don't block webpack's emit to wait for type checker, errors only visible inside CLI
async: true,
// increase performance on multicore systems
workers: forkTsCheckerWorkers,
// checkSyntacticErrors is required as we use happyPackMode and the thread-loader to parallelise the builds
checkSyntacticErrors: true,
// Set the tsconfig.json path
tsconfig: options.configFile,
// Make use of a new API comming with TypeScript 2.7
// which allows to speed up the type checking
// https://github.com/namics/webpack-config-plugins/issues/39
useTypescriptIncrementalApi: true,
// To allow using this plugin even if there is no .ts or .tsx file
// ignore "TS18003: No inputs were found in config file"
ignoreDiagnostics: [18003],
}),
],
});
3 changes: 3 additions & 0 deletions packages/ts-config-webpack-plugin/config/production.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ exports = module.exports = (options) => ({
checkSyntacticErrors: true,
// Set the tsconfig.json path
tsconfig: options.configFile,
// To allow using this plugin even if there is no .ts or .tsx file
// ignore "TS18003: No inputs were found in config file"
ignoreDiagnostics: [18003],
}),
],
});
2 changes: 1 addition & 1 deletion packages/ts-config-webpack-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
},
"dependencies": {
"cache-loader": "^1.2.2",
"fork-ts-checker-webpack-plugin": "^0.5.2",
"fork-ts-checker-webpack-plugin": "1.0.0-alpha.3",
"thread-loader": "^2.1.0",
"ts-loader": "^5.3.1",
"tslint": "^5.12.0"
Expand Down

0 comments on commit e4a6ed8

Please sign in to comment.