Adding fork-ts-checker-webpack-plugin

This allows offloading type checking to another process and saves ~1-2 seconds for each build.
Also, we can integrate ESLint into the build pipeline and this is dope!
This commit is contained in:
David Négrier 2021-05-17 16:09:42 +02:00
parent 6e7f8507b1
commit 79935593e2
3 changed files with 158 additions and 8 deletions

View file

@ -5,6 +5,7 @@ import webpack from 'webpack';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import sveltePreprocess from 'svelte-preprocess';
import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
import NodePolyfillPlugin from 'node-polyfill-webpack-plugin';
const mode = process.env.NODE_ENV ?? 'development';
@ -34,8 +35,12 @@ module.exports = {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
//use: 'ts-loader',
exclude: /node_modules/,
loader: 'ts-loader',
options: {
transpileOnly: true,
},
},
{
test: /\.scss$/,
@ -121,6 +126,11 @@ module.exports = {
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new ForkTsCheckerWebpackPlugin({
eslint: {
files: './src/**/*.ts'
}
}),
new MiniCssExtractPlugin({filename: '[name].[contenthash].css'}),
new HtmlWebpackPlugin(
{