-
Notifications
You must be signed in to change notification settings - Fork 2
/
tsup.config.ts
51 lines (49 loc) · 1.36 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
43
44
45
46
47
48
49
50
51
import fse from 'fs-extra';
import { defineConfig } from 'tsup';
export default defineConfig(() => {
return {
splitting: false,
entry: ['src/**/*.{ts,tsx}', '!src/**/*.test.{ts,tsx}', '!src/**/*.stories.{ts,tsx}'],
external: ['react', 'react-dom', 'react-router-dom'],
format: ['esm', 'cjs'],
target: 'esnext',
outDir: 'dist',
minify: false,
skipNodeModulesBundle: false,
async onSuccess() {
console.log('Build succeeded!');
await fse.copy('src/assets', 'dist/assets');
console.log('Assets copied!');
},
dts: {
entry: [
'src/index.ts',
'src/components/index.ts',
'src/config/index.ts',
'src/constants/index.ts',
'src/layouts/index.ts',
'src/hooks/index.ts',
'src/icons/index.ts',
'src/providers/index.ts',
'src/test-utils/index.ts',
'src/utils/index.ts',
'src/types/index.ts',
],
},
bundle: true,
treeshake: false,
sourcemap: false,
clean: true, // clean up the dist folder before building
platform: 'browser',
define: {
'import.meta.env.TEST': 'false',
'import.meta.env.DEV': 'false',
},
// esbuildOptions(options) {
// options.conditions = ['module']; // https://esbuild.github.io/api/#conditions
// },
// banner: {
// js: "'use client';",
// },
};
});