Qué es tsup

Descubre tsup, empaquetador ultrarrápido para JavaScript/TypeScript con configuración mínima, salida dual (ESM/CJS) y soporte de d.ts, ideal para librerías.

30 ago 2025 • 2 min read • Q2BSTUDIO Team

Inteligencia-Artificial-

tsup es un empaquetador super rápido de JavaScript y TypeScript construido sobre esbuild. Está pensado para librerías: configuración mínima, excelentes valores por defecto y la capacidad de generar en un solo paso builds ESM y CJS además de las declaraciones de tipos.

Por qué usar tsup

- Velocidad gracias a esbuild como motor subyacente.

- Configuración cero o mínima funciona desde la CLI o con un archivo de configuración muy pequeño.

- Salida dual genera ESM y CJS para máxima compatibilidad.

- Definiciones de tipos puede emitir archivos d.ts activando la opción dts.

- Extras útiles modo watch, minificación, treeshaking, code splitting y sourcemaps.

Inicio rápido

Instalación comando ejemplo npm i -D tsup typescript

Scripts sugeridos en package.json ejemplo scripts build: tsup, dev: tsup --watch, prepare: npm run build

Configuración mínima recomendada para tsup en tsup.config.ts entrada src/index.ts, formatos esm y cjs, dts true para emitir .d.ts, sourcemap true, clean true, target es2020 y treeshake true

tsconfig.json minimal ejemplo opciones compilerOptions target ES2020, moduleResolution bundler, strict true, declaration true, emitDeclarationOnly false, skipLibCheck true e incluir carpeta src

Ejecutar npm run build generará dist/index.mjs dist/index.cjs y dist/index.d.ts

Comparación con otras herramientas

- tsc compila TypeScript a JavaScript pero no hace bundling, tsup empaqueta el código y puede marcar dependencias como externas.

- rollup y webpack son muy flexibles y requieren más configuración; tsup es una alternativa ligera tipo rollup para librerías, rápida y sencilla.

- vite es excelente para aplicaciones y servidores de desarrollo; aunque se puede usar para librerías, tsup suele ser más simple para publicar paquetes.

Cuándo usar y cuándo no

- Usar tsup para publicar librerías rápidamente con builds duales y tipos incluidos.

- Si necesitas bundling exótico con plugins personalizados o objetivos de módulo inusuales, rollup o webpack pueden ser más adecuados.

- Si no quieres bundling en absoluto y prefieres salida por archivo, tsc puede ser suficiente.

Conclusión

tsup es una solución rápida y sencilla para empaquetar librerías con definiciones de tipos integradas, ideal para flujos de trabajo que valoran velocidad y simplicidad.

Sobre Q2BSTUDIO

Q2BSTUDIO es una empresa de desarrollo de software especializada en aplicaciones a medida y software a medida. Ofrecemos soluciones completas en inteligencia artificial y ia para empresas, agentes IA y servicios de ciberseguridad para proteger tus activos digitales. Además brindamos servicios cloud aws y azure, servicios de inteligencia de negocio y consultoría en power bi para transformar datos en decisiones accionables. Nuestro enfoque combina experiencia en desarrollo, despliegue cloud y seguridad para entregar productos escalables y seguros.

Si necesitas ayuda para empaquetar tu librería, integrar pipelines de build, migrar a arquitecturas modernas o aprovechar agentes IA y soluciones de inteligencia de negocio como power bi, Q2BSTUDIO puede apoyarte con consultoría y desarrollo a medida en inteligencia artificial, ciberseguridad, servicios cloud aws y azure y mucho más.

A BREAK?

Play for a moment before you go

OUR SERVICES

How we can help you

Artificial intelligence

AI agents, chatbots, and intelligent assistants that automate tasks and serve your customers 24/7 to improve the efficiency of your business.

More info

Software Development

Web, mobile, and desktop applications, intranets, e-commerce, SaaS, and management platforms designed for your company's specific needs.

More info

Cloud services

Migration, infrastructure, managed hosting, high availability, and security on Microsoft Azure and Amazon Web Services to help your business scale without limits.

More info

Cybersecurity and pentesting

Security audits, penetration testing and protection of applications, data and infrastructure on-premise and cloud, with ethical hacking and regulatory compliance.

More info

Business Intelligence

Dashboards and data analysis with Power BI: we integrate your sources, design dashboards and KPIs and turn your data into decisions.

More info

Process automation

We automate repetitive tasks and connect your applications with n8n, Power Automate, Make, and RPA, eliminating manual work and increasing productivity.

More info

Training for Companies

We train your teams in technology with criteria: web development, databases, Git, best practices and security, automation with n8n, artificial intelligence for companies and creation of AI solutions with Azure AI Foundry.

More info

Code Auditing

We audit the code that you, your team or an AI create: we tell you what is good and what to improve, we secure it and make it ready for production, web or app.

More info

AI Image Generation

We create for you the images that your business needs with artificial intelligence: product, networks, advertising, illustration and avatars. You tell us what you want and we deliver it ready to use.

More info

AI Video Generation

We create videos with artificial intelligence for you: promotional, networking, virtual presenters, dubbing and animations. You tell us the idea and we will deliver it assembled and ready to publish.

More info

AI Conversational Avatars

We create conversational avatars with AI – digital humans with a face and voice – that serve your customers and teams with the knowledge of your company, on your website, interactive monitors, WhatsApp or Teams.

More info

Online Marketing and AI

Google Ads, Meta Ads, LinkedIn Ads and AI Engine Positioning (GEO/AEO): we attract customers and make your brand appear where they search for you, also on ChatGPT, Gemini and Perplexity.

More info

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.

Live Chat