discord.js/tsup.config.ts

51 lines
875 B
TypeScript
Raw Normal View History

2023-04-15 03:11:12 +12:00
import type { Options } from 'tsup';
import { defineConfig } from 'tsup';
export function createTsupConfig({
entry = ['src/index.ts'],
external = [],
noExternal = [],
platform = 'node',
format = ['esm', 'cjs'],
target = 'es2022',
skipNodeModulesBundle = true,
clean = true,
2023-08-28 06:24:03 +12:00
shims = format.includes('cjs'),
cjsInterop = format.includes('cjs'),
minify = false,
2023-08-28 06:24:03 +12:00
terserOptions = {
mangle: false,
keep_classnames: true,
keep_fnames: true,
},
splitting = false,
keepNames = true,
dts = true,
sourcemap = true,
esbuildPlugins = [],
2023-08-22 10:30:08 +12:00
treeshake = false,
outDir = 'dist',
2023-04-15 03:11:12 +12:00
}: Options = {}) {
return defineConfig({
entry,
external,
noExternal,
platform,
format,
skipNodeModulesBundle,
target,
clean,
shims,
2023-08-28 06:24:03 +12:00
cjsInterop,
minify,
2023-08-28 06:24:03 +12:00
terserOptions,
splitting,
keepNames,
dts,
sourcemap,
esbuildPlugins,
2023-08-22 10:30:08 +12:00
treeshake,
outDir,
});
}