-
-
Notifications
You must be signed in to change notification settings - Fork 392
Expand file tree
/
Copy pathtsdown.config.ts
More file actions
57 lines (51 loc) · 1.31 KB
/
tsdown.config.ts
File metadata and controls
57 lines (51 loc) · 1.31 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
import { defineConfig } from 'tsdown';
import {
createDualFormatConfig,
createIifeDebugConfig,
packageDirFromMetaUrl,
readPackageVersion,
} from '../../tools/scripts/tsdown/config-helpers.mjs';
const packageDir = packageDirFromMetaUrl(import.meta.url);
const version = readPackageVersion(packageDir);
const buildMode =
process.env.RUNTIME_TSDOWN_MODE === 'debug' ? 'debug' : 'build';
const standardDefine = {
__VERSION__: JSON.stringify(version),
FEDERATION_DEBUG: JSON.stringify(process.env.FEDERATION_DEBUG || ''),
};
const debugDefine = {
__VERSION__: JSON.stringify(version),
FEDERATION_DEBUG: JSON.stringify('true'),
};
const buildConfig = {
...createDualFormatConfig({
name: 'runtime-build',
packageDir,
entry: {
index: 'src/index.ts',
helpers: 'src/helpers.ts',
types: 'src/types.ts',
core: 'src/core.ts',
},
external: ['@module-federation/*'],
dts: {
resolver: 'tsc',
},
define: standardDefine,
copyLicense: true,
unbundle: true,
}),
outputOptions: {
exports: 'named',
},
};
const debugConfig = createIifeDebugConfig({
name: 'runtime-debug',
packageDir,
entry: 'src/index.ts',
outDir: 'dist/debug',
define: debugDefine,
});
export default defineConfig(
buildMode === 'debug' ? [debugConfig] : [buildConfig],
);