1
- import { defineConfig , type Options } from 'tsup' ;
2
1
import { readFile } from 'node:fs/promises' ;
2
+
3
+ import { defineConfig , type Options } from 'tsup' ;
4
+
3
5
import { globalPackages as globalManagerPackages } from 'storybook/internal/manager/globals' ;
4
6
import { globalPackages as globalPreviewPackages } from 'storybook/internal/preview/globals' ;
5
7
6
- // The current browsers supported by Storybook v7
7
- const BROWSER_TARGET : Options [ 'target' ] = [
8
- 'chrome100' ,
9
- 'safari15' ,
10
- 'firefox91' ,
11
- ] ;
12
- const NODE_TARGET : Options [ 'target' ] = [ 'node18' ] ;
8
+ const NODE_TARGET : Options [ 'target' ] = 'node20' ;
13
9
14
10
type BundlerConfig = {
15
11
bundler ?: {
@@ -48,7 +44,9 @@ export default defineConfig(async (options) => {
48
44
minify : ! options . watch ,
49
45
treeshake : true ,
50
46
sourcemap : true ,
51
- clean : options . watch ? false : true ,
47
+ // keep this line commented until https://github.com/egoist/tsup/issues/1270 is resolved
48
+ // clean: options.watch ? false : true,
49
+ clean : false ,
52
50
} ;
53
51
54
52
const configs : Options [ ] = [ ] ;
@@ -64,8 +62,8 @@ export default defineConfig(async (options) => {
64
62
resolve : true ,
65
63
} ,
66
64
format : [ 'esm' , 'cjs' ] ,
67
- target : [ ...BROWSER_TARGET , ...NODE_TARGET ] ,
68
65
platform : 'neutral' ,
66
+ target : NODE_TARGET ,
69
67
external : [ ...globalManagerPackages , ...globalPreviewPackages ] ,
70
68
} ) ;
71
69
}
@@ -78,7 +76,6 @@ export default defineConfig(async (options) => {
78
76
...commonConfig ,
79
77
entry : managerEntries ,
80
78
format : [ 'esm' ] ,
81
- target : BROWSER_TARGET ,
82
79
platform : 'browser' ,
83
80
external : globalManagerPackages ,
84
81
} ) ;
@@ -95,7 +92,6 @@ export default defineConfig(async (options) => {
95
92
resolve : true ,
96
93
} ,
97
94
format : [ 'esm' , 'cjs' ] ,
98
- target : BROWSER_TARGET ,
99
95
platform : 'browser' ,
100
96
external : globalPreviewPackages ,
101
97
} ) ;
@@ -109,7 +105,6 @@ export default defineConfig(async (options) => {
109
105
...commonConfig ,
110
106
entry : nodeEntries ,
111
107
format : [ 'cjs' ] ,
112
- target : NODE_TARGET ,
113
108
platform : 'node' ,
114
109
} ) ;
115
110
}
0 commit comments