-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsup.config.ts
More file actions
42 lines (38 loc) · 1.03 KB
/
tsup.config.ts
File metadata and controls
42 lines (38 loc) · 1.03 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
import { defineConfig } from "tsup";
export default defineConfig({
entry: {
index: "src/index.ts",
unstyled: "src/unstyled.ts",
},
format: ["cjs", "esm"],
dts: true, // Generate TypeScript declarations
splitting: false,
sourcemap: true,
clean: true,
external: ["react", "react-dom"],
minify: true,
treeshake: true,
target: "es2015",
outDir: "dist",
esbuildOptions(options) {
options.banner = {
js: '"use client"',
};
},
onSuccess: async () => {
// Copy CSS files
const fs = await import("fs");
const path = await import("path");
// Create styles directory
const stylesDir = path.join("dist", "styles");
if (!fs.existsSync(stylesDir)) {
fs.mkdirSync(stylesDir, { recursive: true });
}
// Copy animation styles
const animationsSource = path.join("src", "styles", "animations.css");
const animationsDest = path.join("dist", "styles.css");
if (fs.existsSync(animationsSource)) {
fs.copyFileSync(animationsSource, animationsDest);
}
},
});