Skip to content

weapp-vite / TsupOptions

Type Alias: TsupOptions

TsupOptions: object

The options available in tsup.config.ts Not all of them are available from CLI flags

Type declaration

optional banner: BannerOrFooter

bundle?

optional bundle: boolean

Disable bundling, default to true

cjsInterop?

optional cjsInterop: boolean

Interop default within module.exports in cjs

Default

ts
false

clean?

optional clean: boolean | string[]

Clean output directory before each build

config?

optional config: boolean | string

Disable config file with false Or pass a custom config filename

define?

optional define: object

Index Signature

[k: string]: string

dts?

optional dts: boolean | string | DtsConfig

entry?

optional entry: Entry

entryPoints?

optional entryPoints: Entry

Deprecated

Use entry instead

env?

optional env: object

Index Signature

[k: string]: string

esbuildOptions()?

optional esbuildOptions: (options, context) => void

Parameters

options

BuildOptions

context
format

Format

Returns

void

esbuildPlugins?

optional esbuildPlugins: Plugin$1[]

experimentalDts?

optional experimentalDts: boolean | string | ExperimentalDtsConfig

external?

optional external: (string | RegExp)[]

Don't bundle these modules

optional footer: BannerOrFooter

format?

optional format: Format[] | Format

globalName?

optional globalName: string

ignoreWatch?

optional ignoreWatch: string[] | string

inject?

optional inject: string[]

This option allows you to automatically replace a global variable with an import from another file.

See

https://esbuild.github.io/api/#inject

injectStyle?

optional injectStyle: boolean | (css, fileId) => string | Promise<string>

Inject CSS as style tags to document head

Default

ts
{false}

jsxFactory?

optional jsxFactory: string

jsxFragment?

optional jsxFragment: string

keepNames?

optional keepNames: boolean

killSignal?

optional killSignal: KILL_SIGNAL

legacyOutput?

optional legacyOutput: boolean

Output different formats to different folder instead of using different extensions

loader?

optional loader: Record<string, Loader>

Esbuild loader option

metafile?

optional metafile: boolean

Emit esbuild metafile

See

https://esbuild.github.io/api/#metafile

minify?

optional minify: boolean | "terser"

minifyIdentifiers?

optional minifyIdentifiers: boolean

minifySyntax?

optional minifySyntax: boolean

minifyWhitespace?

optional minifyWhitespace: boolean

name?

optional name: string

Optional config name to show in CLI output

noExternal?

optional noExternal: (string | RegExp)[]

Always bundle modules matching given patterns

onSuccess?

optional onSuccess: string | () => Promise<void | undefined | () => void | Promise<void>>

outDir?

optional outDir: string

outExtension?

optional outExtension: OutExtensionFactory

platform?

optional platform: "node" | "browser" | "neutral"

Target platform

Default

node

plugins?

optional plugins: Plugin[]

Experimental Alpha

TSUP plugins

publicDir?

optional publicDir: string | boolean

Copy the files inside publicDir to output directory

pure?

optional pure: string | string[]

See

https://esbuild.github.io/api/#pure

removeNodeProtocol?

optional removeNodeProtocol: boolean

Remove node: protocol from imports

The default value will be flipped to false in the next major release

Default

ts
true

replaceNodeEnv?

optional replaceNodeEnv: boolean

Replace process.env.NODE_ENV with production or developmentproduction when the bundled is minified, development otherwise

shims?

optional shims: boolean

Inject cjs and esm shims if needed

Default

ts
false

silent?

optional silent: boolean

Suppress non-error logs (excluding "onSuccess" process output)

skipNodeModulesBundle?

optional skipNodeModulesBundle: boolean

Skip node_modules bundling Will still bundle modules matching the noExternal option

sourcemap?

optional sourcemap: boolean | "inline"

splitting?

optional splitting: boolean

Code splitting Default to true for ESM, false for CJS.

You can set it to true explicitly, and may want to disable code splitting sometimes: #255

target?

optional target: Target | Target[]

Compile target

default to node16

terserOptions?

optional terserOptions: MinifyOptions

treeshake?

optional treeshake: TreeshakingStrategy

By default esbuild already does treeshaking

But this option allow you to perform additional treeshaking with Rollup

This can result in smaller bundle size

tsconfig?

optional tsconfig: string

Use a custom tsconfig

watch?

optional watch: boolean | string | (string | boolean)[]

Defined in

node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.0_jiti@2.4.0_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/dist/index.d.ts:397

Released under the MIT License.