-
Notifications
You must be signed in to change notification settings - Fork 42
/
app-builder.config.ts
84 lines (78 loc) · 2.28 KB
/
app-builder.config.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
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
84
import * as fs from 'fs';
import * as path from 'path';
import type {ServiceConfig} from '@gravity-ui/app-builder';
// eslint-disable-next-line import/no-extraneous-dependencies
import type {FileCacheOptions, MemoryCacheOptions} from 'webpack';
const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = (relativePath: string) => path.resolve(appDirectory, relativePath);
const getFileCacheConfig = () => {
if (process.env.APP_ENV === 'development') {
return {
type: 'filesystem',
} as FileCacheOptions;
} else {
return {
type: 'memory',
} as MemoryCacheOptions;
}
};
const vendors = (vendorsList: string[]) => {
return vendorsList.concat([
'react-split-pane',
'react-dnd',
'react-grid-layout',
'react-beautiful-dnd',
'@popperjs/core',
'focus-trap',
]);
};
const config: ServiceConfig = {
client: {
alias: {
i18n: 'src/i18n',
shared: 'src/shared',
ui: 'src/ui',
},
modules: [
'node_modules',
resolveApp('node_modules'),
resolveApp('src/ui'),
resolveApp('src/ui/units'),
],
includes: ['src/shared', 'src/i18n', 'node_modules/monaco-editor/esm/vs'],
excludeFromClean: ['!i18n', '!i18n/**/*'],
vendors,
icons: ['src/ui/assets/icons', 'node_modules/@gravity-ui/icons'],
monaco: {
languages: ['typescript', 'javascript', 'json', 'sql', 'mysql'],
},
polyfill: {
process: true,
},
disableReactRefresh: true,
contextReplacement: {
locale: ['ru', 'en'],
},
watchOptions: {
ignored: '**/server',
aggregateTimeout: 1000,
},
cache: getFileCacheConfig(),
externals: {
highcharts: 'Highcharts',
},
fallback: {
url: require.resolve('url'),
'react/jsx-runtime': require.resolve('react/jsx-runtime'),
path: false,
fs: false,
'cose-base': false,
'layout-base': false,
'highlight.js': false,
},
},
server: {
watch: ['dist/i18n', 'dist/shared'],
},
};
export default config;