From 4b3a14431ebcdd9a6de2e635c0c3a2d36cf6a473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Pavez?= Date: Wed, 29 Jul 2020 16:08:18 -0400 Subject: [PATCH] Integrated "fork-ts-checker-webpack-plugin" to analyze typescript errors automatically in the compilation process, without the need to do it manually with tsc (Requires tsconfig.json file in the folder from where it is compiled) --- index.js | 2 ++ package.json | 3 +++ 2 files changed, 5 insertions(+) diff --git a/index.js b/index.js index b971b73..7579448 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,5 @@ let mix = require("laravel-mix"); +const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); class ReactTypeScript { constructor() { @@ -49,6 +50,7 @@ class ReactTypeScript { webpackConfig(webpackConfig) { webpackConfig.resolve.extensions.push(".ts", ".tsx"); + webpackConfig.plugins.push(new ForkTsCheckerWebpackPlugin()); } babelConfig() { diff --git a/package.json b/package.json index d4e321d..de1e53d 100644 --- a/package.json +++ b/package.json @@ -22,5 +22,8 @@ "homepage": "https://github.com/raicem/laravel-mix-react-typescript-extension#readme", "peerDependencies": { "laravel-mix": "^4.0.0" + }, + "devDependencies": { + "fork-ts-checker-webpack-plugin": "^5.0.12" } }