forked from clerk/javascript
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtsup.config.ts
36 lines (32 loc) · 1.08 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
import { esbuildPluginFilePathExtensions } from 'esbuild-plugin-file-path-extensions';
import type { Options } from 'tsup';
import { defineConfig } from 'tsup';
import { runAfterLast } from '../../scripts/utils';
// @ts-ignore
import { name, version } from './package.json';
export default defineConfig(overrideOptions => {
const isProd = overrideOptions.env?.NODE_ENV === 'production';
const shouldPublish = !!overrideOptions.env?.publish;
const common: Options = {
entry: ['./src/**/*.{ts,tsx,js,jsx}', '!./src/**/*.test.{ts,tsx}'],
bundle: true,
clean: true,
minify: false,
sourcemap: true,
treeshake: true,
format: 'esm',
outDir: './dist',
dts: true,
// @ts-expect-error - Type issue from the esbuild-plugin-file-path-extensions
esbuildPlugins: [esbuildPluginFilePathExtensions({ esmExtension: 'js' })],
define: {
PACKAGE_NAME: `"${name}"`,
PACKAGE_VERSION: `"${version}"`,
__DEV__: `${!isProd}`,
},
};
return runAfterLast([
// 'pnpm build:declarations',
shouldPublish && 'pnpm publish:local',
])(common);
});