Open vforsh opened 2 years ago
Workaround: build in two phases (w/ and w/o --minify
flag) with the following config:
import {defineConfig} from 'tsup';
export default defineConfig({
outExtension: ({options, format}) => {
const formatExtension = [options.minify ? 'min' : '', format].filter(Boolean).join('.');
return {
js: `.${formatExtension}.js`,
};
},
});
Right now I use an onSuccess callback for this:
onSuccess: "esbuild --minify --sourcemap ./dist/lib.js --outfile=./dist/lib.min.js"
But it would be nice to have an option for this.
Thanks for an awesome tool!
Upvote & Fund