-
-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
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,6 @@ | ||
module.exports = { | ||
"presets": [ | ||
"@babel/preset-env", | ||
"@babel/preset-typescript" | ||
] | ||
} |
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,17 @@ | ||
## babel-loader configuration example | ||
|
||
It's a basic configuration of the plugin and [babel-loader](https://github.com/babel/babel-loader). | ||
Very similar to the [ts-loader example](../ts-loader), the main difference in the configuration is that we | ||
enable **syntactic diagnostics**: | ||
|
||
```js | ||
new ForkTsCheckerWebpackPlugin({ | ||
typescript: { | ||
diagnosticOptions: { | ||
semantic: true, | ||
syntactic: true, | ||
}, | ||
}, | ||
}) | ||
``` | ||
|
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,21 @@ | ||
{ | ||
"name": "fork-ts-checker-webpack-plugin-babel-loader-example", | ||
"version": "0.0.0", | ||
"main": "dist/index.js", | ||
"license": "MIT", | ||
"scripts": { | ||
"dev": "webpack-dev-server", | ||
"build": "webpack -p" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.6.0", | ||
"@babel/preset-env": "^7.6.0", | ||
"@babel/preset-typescript": "^7.6.0", | ||
"babel-loader": "^8.0.0", | ||
"fork-ts-checker-webpack-plugin": "^5.0.0-alpha.9", | ||
"typescript": "^3.8.0", | ||
"webpack": "^4.0.0", | ||
"webpack-cli": "^3.0.0", | ||
"webpack-dev-server": "^3.0.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 @@ | ||
console.log('Hello world'); |
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,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"] | ||
} |
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,28 @@ | ||
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: 'babel-loader', | ||
exclude: /node_modules/, | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
new ForkTsCheckerWebpackPlugin({ | ||
typescript: { | ||
diagnosticOptions: { | ||
semantic: true, | ||
syntactic: true, | ||
}, | ||
}, | ||
}), | ||
], | ||
}; |