forked from enmity-mod/enmity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
95 lines (92 loc) · 2.05 KB
/
rollup.config.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
84
85
86
87
88
89
90
91
92
93
94
95
import { execSync } from 'child_process';
import { defineConfig } from 'rollup';
// Rollup Plugins
import { typescriptPaths } from 'rollup-plugin-typescript-paths';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import { swc } from 'rollup-plugin-swc3';
const revision = execSync('git rev-parse --short HEAD').toString().trim();
export default defineConfig({
input: 'src/index.ts',
treeshake: true,
inlineDynamicImports: true,
output: [
{
file: 'dist/Enmity.js',
format: 'esm',
strict: false
}
],
plugins: [
typescriptPaths({
preserveExtensions: true
}),
nodeResolve({
jsnext: true
}),
swc({
jsc: {
minify: {
compress: true
},
parser: {
'syntax': 'typescript',
'tsx': true
},
target: 'es2022',
baseUrl: './src/',
paths: {
'@metro/*': [
'modules/metro/index',
'modules/metro/*'
],
'@data/*': [
'data/*'
],
'@utilities/*': [
'modules/utilities/*'
],
'@patcher/*': [
'modules/patcher/index',
'modules/patcher/*'
],
'@api/*': [
'api/index',
'api/*'
],
'@api/settings/*': [
'api/settings/index'
],
'@components/*': [
'components/index',
'components/*'
],
'@managers/*': [
'managers/*'
],
'@screens/*': [
'core/screens/*'
],
'@modules/*': [
'modules/*'
],
'react/*': [
'modules/metro/react',
],
'@core/*': [
'core/*'
]
}
}
}),
replace({
preventAssignment: true,
'__VERSION__': revision
})
],
onwarn(warning, warn) {
// suppress eval warnings
if (warning.code === 'EVAL') return;
warn(warning);
}
});