Skip to content

Commit

Permalink
docs: add ts-loader example
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-oles committed May 27, 2020
1 parent b5d5977 commit be9cd64
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 1 deletion.
Binary file modified .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -50,6 +50,7 @@ module.exports = {
{
test: /\.tsx?$/,
loader: 'ts-loader',
exclude: /node_modules/,
options: {
// disable type checker - we will use it in fork plugin
transpileOnly: true
Expand Down
3 changes: 3 additions & 0 deletions examples/ts-loader/README.md
@@ -0,0 +1,3 @@
## ts-loader configuration example

It's a basic configuration of the plugin and [ts-loader](https://github.com/TypeStrong/ts-loader).
18 changes: 18 additions & 0 deletions examples/ts-loader/package.json
@@ -0,0 +1,18 @@
{
"name": "fork-ts-checker-webpack-plugin-ts-loader-example",
"version": "0.0.0",
"main": "dist/index.js",
"license": "MIT",
"scripts": {
"dev": "webpack-dev-server",
"build": "webpack -p"
},
"devDependencies": {
"fork-ts-checker-webpack-plugin": "^5.0.0-alpha.9",
"ts-loader": "^7.0.0",
"typescript": "^3.8.0",
"webpack": "^4.0.0",
"webpack-cli": "^3.0.0",
"webpack-dev-server": "^3.0.0"
}
}
1 change: 1 addition & 0 deletions examples/ts-loader/src/index.ts
@@ -0,0 +1 @@
console.log('Hello world');
18 changes: 18 additions & 0 deletions examples/ts-loader/tsconfig.json
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "ES5",
"module": "CommonJS",
"lib": ["ES5", "ScriptHost"],
"moduleResolution": "Node",
"esModuleInterop": true,
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"strict": true,
"baseUrl": "./src",
"outDir": "./dist",
"forceConsistentCasingInFileNames": true,
"importsNotUsedAsValues": "preserve" // this is important for proper files watching
},
"include": ["./src"],
"exclude": ["node_modules"]
}
22 changes: 22 additions & 0 deletions examples/ts-loader/webpack.config.js
@@ -0,0 +1,22 @@
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');

module.exports = {
context: __dirname,
entry: './src/index.ts',
resolve: {
extensions: ['.ts', '.tsx', '.js'],
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
exclude: /node_modules/,
options: {
transpileOnly: true,
},
},
],
},
plugins: [new ForkTsCheckerWebpackPlugin()],
};
2 changes: 1 addition & 1 deletion examples/vscode-tasks/README.md
@@ -1,4 +1,4 @@
## VS Code Configuration Example
## VS Code configuration example

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

0 comments on commit be9cd64

Please sign in to comment.