-
-
Notifications
You must be signed in to change notification settings - Fork 393
Expand file tree
/
Copy pathrslib.config.ts
More file actions
69 lines (66 loc) · 1.39 KB
/
rslib.config.ts
File metadata and controls
69 lines (66 loc) · 1.39 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
68
69
import { defineConfig } from '@rslib/core';
import { readFileSync } from 'fs';
import { join } from 'path';
const pkg = JSON.parse(
readFileSync(join(process.cwd(), 'package.json'), 'utf-8'),
);
const FEDERATION_DEBUG = process.env.FEDERATION_DEBUG || '';
export default defineConfig({
lib: [
{
format: 'esm',
syntax: 'es2021',
bundle: false,
outBase: 'src',
dts: {
bundle: false,
distPath: './dist',
},
},
{
format: 'cjs',
syntax: 'es2021',
bundle: false,
outBase: 'src',
dts: false,
},
],
source: {
entry: {
index: [
'./src/**/*.{ts,tsx,js,jsx}',
'!./src/**/*.spec.*',
'!./src/**/*.test.*',
],
},
define: {
__VERSION__: JSON.stringify(pkg.version),
FEDERATION_DEBUG: JSON.stringify(FEDERATION_DEBUG),
},
tsconfigPath: './tsconfig.lib.json',
},
output: {
target: 'node',
minify: false,
distPath: {
root: './dist',
},
externals: [/@module-federation\//],
copy: [
{
from: './LICENSE',
to: '.',
},
],
},
tools: {
rspack: (config: any) => {
if (FEDERATION_DEBUG && config.output?.library?.type === 'module') {
config.output.library.type = 'var';
config.output.iife = true;
config.externals = undefined;
}
return config;
},
},
});