-
Notifications
You must be signed in to change notification settings - Fork 327
/
Copy pathtsup.config.ts
41 lines (35 loc) · 1.06 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
import type { Options } from 'tsup';
import { defineConfig } from 'tsup';
import { runAfterLast } from '../../scripts/utils';
import { name, version } from './package.json';
export default defineConfig(overrideOptions => {
const isWatch = !!overrideOptions.watch;
const shouldPublish = !!overrideOptions.env?.publish;
const common: Options = {
entry: ['./src/index.ts', './src/background/index.ts', './src/react/index.ts'],
bundle: true,
clean: true,
minify: false,
sourcemap: true,
legacyOutput: true,
treeshake: true,
noExternal: ['@clerk/clerk-react', '@clerk/shared'],
external: ['use-sync-external-store'],
define: {
PACKAGE_NAME: `"${name}"`,
PACKAGE_VERSION: `"${version}"`,
__DEV__: `${isWatch}`,
__BUILD_DISABLE_RHC__: 'true',
},
};
const esm: Options = {
...common,
format: 'esm',
};
const cjs: Options = {
...common,
format: 'cjs',
outDir: './dist/cjs',
};
return runAfterLast(['pnpm build:declarations', shouldPublish && 'pnpm publish:local'])(esm, cjs);
});