generated from storybookjs/addon-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tsup.config.ts
42 lines (39 loc) · 1.04 KB
/
tsup.config.ts
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, type Options } from "tsup";
import { globalPackages as globalManagerPackages } from "@storybook/core/manager/globals";
import { globalPackages as globalPreviewPackages } from "@storybook/core/preview/globals";
const NODE_TARGET: Options["target"] = ["node16"];
const BROWSER_TARGET: Options["target"] = [
"chrome100",
"safari15",
"firefox91",
];
export default defineConfig(async (options) => {
const commonConfig: Options = {
splitting: false,
minify: !options.watch,
treeshake: true,
sourcemap: true,
clean: true,
};
return [
{
...commonConfig,
entry: ["src/index.ts", "src/preset.ts"],
dts: {
resolve: true,
},
format: ["esm", "cjs"],
target: [...NODE_TARGET],
platform: "node",
external: [...globalManagerPackages, ...globalPreviewPackages],
},
{
...commonConfig,
entry: ["src/preview.tsx"],
format: ["esm"],
target: BROWSER_TARGET,
platform: "browser",
external: globalPreviewPackages,
},
];
});