Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fork-ts-checker-webpack-plugin info and examples (#540)
* Add fork-ts-checker-webpack-plugin info and examples * Self CR
- Loading branch information
1 parent
71d0299
commit 9249f56
Showing
7 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "webpack2-fork-ts-checker", | ||
"main": "index.js", | ||
"version": "1.0.0", | ||
"scripts": { | ||
"start": "./node_modules/.bin/webpack --watch" | ||
}, | ||
"devDependencies": { | ||
"fork-ts-checker-webpack-plugin": "^0.1.2", | ||
"ts-loader": "^2.0.3", | ||
"typescript": "^2.2.2", | ||
"webpack": "^2.2.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
const x: number = '1'; | ||
|
||
export = x; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
const x: number = 1; | ||
|
||
export = x; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
import * as x1 from './fileWithoutError'; | ||
import * as x2 from './fileWithError'; | ||
|
||
export = x1 + x2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"compilerOptions": { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
'use strict'; | ||
|
||
var process = require('process'); | ||
var ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); | ||
|
||
module.exports = { | ||
context: __dirname, // to automatically find tsconfig.json | ||
entry: './src/index.ts', | ||
output: { filename: 'index.js' }, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.tsx?$/, | ||
loader: 'ts-loader', | ||
options: { | ||
transpileOnly: true // IMPORTANT! use transpileOnly mode to speed-up compilation | ||
} | ||
} | ||
] | ||
}, | ||
resolve: { | ||
extensions: [ '.ts', '.tsx' ] | ||
}, | ||
plugins: [ | ||
new ForkTsCheckerWebpackPlugin({ | ||
tslint: false, // disable tslint support | ||
watch: './src', // optional but improves performance (less stat calls) | ||
workers: ForkTsCheckerWebpackPlugin.TWO_CPUS_FREE, // use multi-process mode, leave 2 cpu's free for builder and system | ||
blockEmit: process.env.NODE_ENV === 'production' // for production make it synchronous | ||
}) | ||
] | ||
}; |