-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.main.config.ts
More file actions
52 lines (47 loc) · 1.43 KB
/
webpack.main.config.ts
File metadata and controls
52 lines (47 loc) · 1.43 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import path from 'path';
// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
const relocateLoader = require('@vercel/webpack-asset-relocator-loader');
import { IgnorePlugin } from 'webpack';
import type { Compiler, Compilation, Configuration } from 'webpack';
import { rules } from './webpack.rules';
const IGNORE_RESOURCES = [
'pg',
'pg-native',
'pg-query-stream',
'oracledb',
'mysql2',
'mysql',
'tedious',
'sqlite3',
'nock',
'aws-sdk',
'mock-aws-s3',
];
export const mainConfig: Configuration = {
entry: './application/main.ts',
module: { rules },
plugins: [
new IgnorePlugin({
checkResource(resource): boolean {
return IGNORE_RESOURCES.includes(resource);
},
}),
{
apply(compiler: Compiler): void {
compiler.hooks.compilation.tap('webpack-asset-relocator-loader', (compilation: Compilation) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
relocateLoader.initAssetCache(compilation, 'native_modules');
},
);
},
},
],
resolve: {
alias: {
'@application': path.resolve(__dirname, './application'),
'@constants': path.resolve(__dirname, './constants'),
'@assets': path.resolve(__dirname, './assets'),
},
extensions: ['.js', '.ts', '.jsx', '.tsx', '.css', '.scss', '.sass', '.json'],
},
};