-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsup.config.example.ts
More file actions
45 lines (41 loc) · 1.13 KB
/
Copy pathtsup.config.example.ts
File metadata and controls
45 lines (41 loc) · 1.13 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
45
import { defineConfig, Options } from 'tsup'
import { esbuildPluginFilePathExtensions } from 'esbuild-plugin-file-path-extensions'
export default defineConfig((options: Options) => ({
treeshake: true,
splitting: true,
format: ['esm', 'cjs'],
dts: true,
minify: true,
sourcemap: true,
clean: true,
entry: ['src/index.ts'],
// target: 'es2020',
// entry: ['src/**/*.tsx'],
// external: ['react'],
...options,
}))
// example configs from `react-query`
export function modernConfig(opts: Partial<Options>) {
return {
entry: opts.entry,
format: ['cjs', 'esm'],
target: ['chrome91', 'firefox90', 'edge91', 'safari15', 'ios15', 'opera77'],
outDir: 'build/modern',
dts: true,
sourcemap: true,
clean: true,
esbuildPlugins: [esbuildPluginFilePathExtensions({ esmExtension: 'js' })],
}
}
export function legacyConfig(opts: Partial<Options>) {
return {
entry: opts.entry,
format: ['cjs', 'esm'],
target: ['es2020', 'node16'],
outDir: 'build/legacy',
dts: true,
sourcemap: true,
clean: true,
esbuildPlugins: [esbuildPluginFilePathExtensions({ esmExtension: 'js' })],
}
}