Skip to content

Commit be9cd64

Browse files
committed
docs: add ts-loader example
1 parent b5d5977 commit be9cd64

File tree

8 files changed

+64
-1
lines changed

8 files changed

+64
-1
lines changed

.DS_Store

0 Bytes
Binary file not shown.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ module.exports = {
5050
{
5151
test: /\.tsx?$/,
5252
loader: 'ts-loader',
53+
exclude: /node_modules/,
5354
options: {
5455
// disable type checker - we will use it in fork plugin
5556
transpileOnly: true

examples/ts-loader/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## ts-loader configuration example
2+
3+
It's a basic configuration of the plugin and [ts-loader](https://github.com/TypeStrong/ts-loader).

examples/ts-loader/package.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "fork-ts-checker-webpack-plugin-ts-loader-example",
3+
"version": "0.0.0",
4+
"main": "dist/index.js",
5+
"license": "MIT",
6+
"scripts": {
7+
"dev": "webpack-dev-server",
8+
"build": "webpack -p"
9+
},
10+
"devDependencies": {
11+
"fork-ts-checker-webpack-plugin": "^5.0.0-alpha.9",
12+
"ts-loader": "^7.0.0",
13+
"typescript": "^3.8.0",
14+
"webpack": "^4.0.0",
15+
"webpack-cli": "^3.0.0",
16+
"webpack-dev-server": "^3.0.0"
17+
}
18+
}

examples/ts-loader/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('Hello world');

examples/ts-loader/tsconfig.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES5",
4+
"module": "CommonJS",
5+
"lib": ["ES5", "ScriptHost"],
6+
"moduleResolution": "Node",
7+
"esModuleInterop": true,
8+
"skipLibCheck": true,
9+
"skipDefaultLibCheck": true,
10+
"strict": true,
11+
"baseUrl": "./src",
12+
"outDir": "./dist",
13+
"forceConsistentCasingInFileNames": true,
14+
"importsNotUsedAsValues": "preserve" // this is important for proper files watching
15+
},
16+
"include": ["./src"],
17+
"exclude": ["node_modules"]
18+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
2+
3+
module.exports = {
4+
context: __dirname,
5+
entry: './src/index.ts',
6+
resolve: {
7+
extensions: ['.ts', '.tsx', '.js'],
8+
},
9+
module: {
10+
rules: [
11+
{
12+
test: /\.tsx?$/,
13+
loader: 'ts-loader',
14+
exclude: /node_modules/,
15+
options: {
16+
transpileOnly: true,
17+
},
18+
},
19+
],
20+
},
21+
plugins: [new ForkTsCheckerWebpackPlugin()],
22+
};

examples/vscode-tasks/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## VS Code Configuration Example
1+
## VS Code configuration example
22

33
This example defines `.vscode/tasks.json` file which instructs **VS Code** how to extract errors from the webpack's output
44
to display them in the **Problems** tab. It uses [TypeScript + Webpack Problem Matchers](https://marketplace.visualstudio.com/items?itemName=eamodio.tsl-problem-matcher)

0 commit comments

Comments
 (0)