forked from RedisInsight/RedisInsight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.base.js
83 lines (77 loc) · 2.18 KB
/
webpack.config.base.js
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import path from 'path';
import webpack from 'webpack';
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin';
import { dependencies as externals } from '../redisinsight/package.json';
export default {
externals: [...Object.keys(externals || {})],
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
cacheDirectory: true,
},
},
},
],
},
output: {
path: path.join(__dirname, '..'),
// commonjs2 https://github.com/webpack/webpack/issues/1114
libraryTarget: 'commonjs2',
},
resolve: {
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx', '.scss'],
plugins: [
new TsconfigPathsPlugin({
configFile: path.join(__dirname, '..', 'tsconfig.json'),
}),
],
alias: {
src: path.resolve(__dirname, '../redisinsight/api/src'),
apiSrc: path.resolve(__dirname, '../redisinsight/api/src'),
uiSrc: path.resolve(__dirname, '../redisinsight/ui/src'),
},
modules: [path.join(__dirname, '../redisinsight/api'), 'node_modules'],
},
plugins: [
new webpack.EnvironmentPlugin({
}),
new webpack.IgnorePlugin({
checkResource(resource) {
const lazyImports = [
'@nestjs/microservices',
// '@nestjs/platform-express',
// 'pnpapi',
'cache-manager',
// 'class-validator',
'fastify-static',
'fastify-swagger',
// 'hiredis',
// 'reflect-metadata',
// 'swagger-ui-express',
// 'class-transformer',
// 'class-transformer/storage',
// '@nestjs/websockets',
// '@nestjs/core/adapters/http-adapter',
// '@nestjs/core/helpers/router-method-factory',
// '@nestjs/core/metadata-scanner',
'@nestjs/microservices/microservices-module',
// '@nestjs/websockets/socket-module',
];
if (!lazyImports.includes(resource)) {
return false;
}
try {
require.resolve(resource);
} catch (err) {
return true;
}
return false;
},
}),
],
};