@@ -2,11 +2,13 @@ import { chmod } from "node:fs/promises";
2
2
import { builtinModules } from "node:module" ;
3
3
import path from "node:path" ;
4
4
5
- import webpack , {
5
+ import {
6
+ BannerPlugin ,
6
7
type Compiler ,
7
8
type Configuration ,
8
9
type ExternalItemFunctionData ,
9
10
} from "webpack" ;
11
+ import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin" ;
10
12
11
13
import { stripPrefix } from "@code-chronicles/util/stripPrefix" ;
12
14
import { stripPrefixOrThrow } from "@code-chronicles/util/stripPrefixOrThrow" ;
@@ -16,7 +18,7 @@ import packageJson from "./package.json" with { type: "json" };
16
18
class WebpackMakeOutputExecutablePlugin {
17
19
// eslint-disable-next-line class-methods-use-this -- This is the interface expected by webpack.
18
20
apply ( compiler : Compiler ) : void {
19
- compiler . hooks . afterEmit . tapAsync (
21
+ compiler . hooks . afterEmit . tapPromise (
20
22
"WebpackMakeOutputExecutablePlugin" ,
21
23
async ( compilation ) => {
22
24
const promises : Promise < void > [ ] = [ ] ;
@@ -59,7 +61,6 @@ const config: Configuration = {
59
61
{
60
62
loader : "ts-loader" ,
61
63
options : {
62
- // TODO: Consider using fork-ts-checker-webpack-plugin for typechecking.
63
64
transpileOnly : true ,
64
65
} ,
65
66
} ,
@@ -84,13 +85,15 @@ const config: Configuration = {
84
85
) ,
85
86
86
87
plugins : [
87
- new webpack . BannerPlugin ( {
88
+ new BannerPlugin ( {
88
89
banner : "#!/usr/bin/env node\n" ,
89
90
raw : true ,
90
91
entryOnly : true ,
91
92
} ) ,
92
93
93
94
new WebpackMakeOutputExecutablePlugin ( ) ,
95
+
96
+ new ForkTsCheckerWebpackPlugin ( ) ,
94
97
] ,
95
98
} ;
96
99
0 commit comments