-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtsup.config.ts
More file actions
44 lines (43 loc) · 1.15 KB
/
tsup.config.ts
File metadata and controls
44 lines (43 loc) · 1.15 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
import { defineConfig } from "tsup";
import postcss from "postcss";
import path from "path";
import fs from "fs";
export default defineConfig({
entry: ["src/index.ts", "src/components/**/*.tsx"],
format: ["cjs", "esm"],
dts: true,
clean: true,
sourcemap: true,
external: ["react", "react-dom", "@improbable-eng/grpc-web"],
loader: {
".js": "jsx",
".jsx": "jsx",
".ts": "tsx",
".tsx": "tsx",
".css": "css",
},
esbuildOptions(options) {
options.plugins = [
{
name: "postcss-plugin",
setup(build) {
build.onLoad({ filter: /\.css$/ }, async (args) => {
const css = fs.readFileSync(args.path, "utf-8");
const result = await postcss([
require("tailwindcss"),
require("autoprefixer"),
]).process(css, {
from: args.path,
to: path.join(path.dirname(args.path), "dist", "styles.css"),
});
return { contents: result.css, loader: "css" };
});
},
},
];
options.loader = { ".ts": "tsx", ".js": "jsx" };
options.alias = {
"@/rapida": "./src",
};
},
});