-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrslib.config.ts
More file actions
67 lines (62 loc) · 1.34 KB
/
rslib.config.ts
File metadata and controls
67 lines (62 loc) · 1.34 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import type { Minify } from '@rsbuild/core';
import { defineConfig, type LibConfig } from '@rslib/core';
import { pluginAreTheTypesWrong } from 'rsbuild-plugin-arethetypeswrong';
const commonExternals: Array<string | RegExp> = [
'webpack',
/[\\/]compiled[\\/]/,
];
const nodeMinifyConfig: Minify = {
js: true,
css: false,
jsOptions: {
minimizerOptions: {
// preserve variable name and disable minify for easier debugging
mangle: false,
minify: false,
compress: {
keep_fnames: true,
},
},
},
};
const esmConfig: LibConfig = {
format: 'esm',
experiments: {
advancedEsm: true,
},
syntax: 'es2022',
dts: {
build: true,
// Only use tsgo in local dev for faster build, disable it in CI until it's more stable
tsgo: !process.env.CI,
},
output: {
minify: nodeMinifyConfig,
},
};
const cjsConfig: LibConfig = {
format: 'cjs',
syntax: 'es2022',
output: {
minify: nodeMinifyConfig,
},
};
export default defineConfig({
lib: [esmConfig, cjsConfig],
tools: {
rspack: {
externals: commonExternals,
},
},
plugins: [
pluginAreTheTypesWrong({
enable: Boolean(process.env.CI),
areTheTypesWrongOptions: {
ignoreRules: [
// The dual package always provide the ESM types.
'false-esm',
],
},
}),
],
});