egoist / tsup

The simplest and fastest way to bundle your TypeScript libraries.
https://tsup.egoist.dev
MIT License
8.46k stars 209 forks source link

[Feature Request] Expose `esbuild.build().outputFiles` #1119

Open brianjenkins94 opened 1 month ago

brianjenkins94 commented 1 month ago

I can do this with esbuild:

const bundle = (await esbuild.build({
    "bundle": true,
    "format": "esm",
    "stdin": {
        "resolveDir": __dirname,
        "sourcefile": "input.ts",
        "contents": contents
    },
    "write": false
})).outputFiles[0]

Would be neat if I could do the same with tsup:

const bundle = tsup.build({
    "esbuildOptions": {},
    "esbuildPlugins": [],
    "format": "esm",
    "treeshake": true,
    "entry": entry
});

// OR

const bundle = await new Promise(function(resolve, reject) {
    tsup.build({
        "onSuccess": function({ outputFiles }) {
            resolve(outputFiles[0]);
        }
    });
});

Upvote & Fund

Fund with Polar

brianjenkins94 commented 1 month ago

Whoops, this may be a duplicate of https://github.com/egoist/tsup/issues/1082.