forked from coinbase/onchainkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tsup.config.ts
50 lines (47 loc) · 1.52 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
// biome-ignore lint/correctness/noNodejsModules: We need this for development only
import { spawnSync } from 'node:child_process';
import { defineConfig } from 'tsup';
export default defineConfig({
entry: ['src/**/index.ts', 'src/**/theme.ts', 'src/**/styles.css'],
format: 'esm',
minify: false, // Disable minification during development
splitting: true, // Enable code splitting to properly handle React contexts
esbuildOptions(options) {
options.jsx = 'automatic';
options.jsxImportSource = 'react';
},
sourcemap: true,
outDir: 'playground/nextjs-app-router/node_modules/@coinbase/onchainkit/esm',
dts: false,
clean: false,
silent: true, // Flip this to false to see tsup output in the terminal, including performance logs
inject: ['react-shim.js'],
// Generate declaration files separately to improve performance in development
async onSuccess() {
console.log('⚡ Rebuilt onchainkit.');
spawnSync(
'tsc',
[
'--emitDeclarationOnly',
'--declaration',
'--outDir',
'playground/nextjs-app-router/node_modules/@coinbase/onchainkit/esm',
'--rootDir',
'src',
'src/index.ts',
'src/*.ts',
'src/**/index.ts',
'src/**/theme.ts',
'--incremental',
'--tsBuildInfoFile',
'playground/nextjs-app-router/node_modules/@coinbase/onchainkit/esm/tsbuildinfo.json',
'--jsx',
'react-jsx',
],
{
shell: true,
},
);
console.log('Declaration files generated.');
},
});