-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.plugins.ts
33 lines (30 loc) · 1.05 KB
/
webpack.plugins.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import type {
Compilation,
Configuration,
WebpackPluginInstance,
} from 'webpack';
import type IForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
import ESLintPlugin from 'eslint-webpack-plugin';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const ForkTsCheckerWebpackPlugin: typeof IForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const relocateLoader: {
initAssetCache: (compilation: Compilation, outputAssetBase: string) => void;
} = require('@vercel/webpack-asset-relocator-loader');
const AssetRelocatorPlugin: WebpackPluginInstance = {
apply(compiler) {
compiler.hooks.compilation.tap(
'webpack-asset-relocator-loader',
(compilation) => {
relocateLoader.initAssetCache(compilation, 'native_modules');
},
);
},
};
export const plugins: Required<Configuration>['plugins'] = [
new ForkTsCheckerWebpackPlugin({
logger: 'webpack-infrastructure',
}),
AssetRelocatorPlugin,
new ESLintPlugin(),
];