-
Notifications
You must be signed in to change notification settings - Fork 1k
/
tsup.config.ts
37 lines (35 loc) · 847 Bytes
/
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
import type { Options } from 'tsup'
import { defineConfig } from 'tsup'
export default defineConfig(options => {
const commonOptions: Partial<Options> = {
entry: {
'redux-thunk': 'src/index.ts',
},
tsconfig: 'tsconfig.build.json',
...options,
}
return [
{
...commonOptions,
format: ['esm'],
outExtension: () => ({ js: '.mjs' }),
dts: true,
clean: true,
},
// Support Webpack 4 by pointing `"module"` to a file with a `.js` extension
{
...commonOptions,
format: ['esm'],
target: 'es2017',
dts: false,
outExtension: () => ({ js: '.js' }),
entry: { 'redux-thunk.legacy-esm': 'src/index.ts' },
},
{
...commonOptions,
format: 'cjs',
outDir: './dist/cjs/',
outExtension: () => ({ js: '.cjs' }),
},
]
})