-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathtsup.config.ts
40 lines (35 loc) · 928 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
38
39
40
import { defineConfig, Options } from 'tsup';
import { nodeModulesPolyfillPlugin } from 'esbuild-plugins-node-modules-polyfill';
const watchMode = process.argv.includes('--watch');
const config: Options = {
entry: {
index: './src/npmlibary.tsx',
},
sourcemap: true,
external: ['react', 'react-dom', '@solana/web3.js'],
format: ['cjs'],
target: 'es6',
cjsInterop: true,
tsconfig: './tsconfig.npm.json',
esbuildPlugins: [
nodeModulesPolyfillPlugin({
modules: {
fs: 'empty',
},
}),
],
};
const buildConfig: Options = {
clean: true, // Clean the output directory before building
outDir: './dist',
dts: true,
};
const startConfig: Options = {
clean: false, // Do not clean the output directory, so compiler can reuse previous entry points
outDir: './dist',
dts: true,
};
export default defineConfig({
...config,
...(watchMode ? startConfig : buildConfig),
});