-
Notifications
You must be signed in to change notification settings - Fork 0
/
tsup.config.js
37 lines (33 loc) · 944 Bytes
/
tsup.config.js
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
import { globalPackages as globalManagerPackages } from '@storybook/manager/globals';
import { globalPackages as globalPreviewPackages } from '@storybook/preview/globals';
import { defineConfig } from 'tsup';
// The current browsers supported by Storybook v7
const BROWSER_TARGET = ['chrome100', 'safari15', 'firefox91'];
export default defineConfig(async (options) => {
const commonConfig = {
splitting: false,
minify: !options.watch,
treeshake: true,
sourcemap: true,
clean: true,
};
const configs = [
{
...commonConfig,
entry: ['src/manager.js'],
format: ['esm'],
target: BROWSER_TARGET,
platform: 'browser',
external: globalManagerPackages,
},
{
...commonConfig,
entry: ['src/preview.js'],
format: ['esm', 'cjs'],
target: BROWSER_TARGET,
platform: 'browser',
external: globalPreviewPackages,
},
];
return configs;
});