-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtsdown.config.ts
More file actions
39 lines (35 loc) · 980 Bytes
/
tsdown.config.ts
File metadata and controls
39 lines (35 loc) · 980 Bytes
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
import {defineConfig} from 'tsdown'
import type { UserConfig } from 'tsdown';
import { access } from "node:fs/promises";
import { F_OK } from "node:constants";
const config: UserConfig = [{
name: 'Main build',
dts: true,
sourcemap: true,
treeshake: true,
attw: true,
entry: [
'./src/index.node.ts',
'./src/index.browser.ts',
],
format: ['cjs', 'esm'],
minify: false,
unused: true,
outExtensions: ({format}) => ({
js: `.${format === "cjs" ? "cjs" : "mjs"}`,
}),
ignoreWatch: ['server/**', 'scripts/**', 'tests/**', 'docs/**', 'examples/**', 'node_modules/**' ],
}];
const devConfig: UserConfig = {
name: 'dev test file',
dts: false,
entry: './test.ts',
outDir: 'dist',
format: "esm"
};
if (typeof devConfig.entry === 'string' && await access(devConfig.entry, F_OK)
.then(() => true)
.catch(() => false)) {
config.push(devConfig);
}
export default defineConfig(config);