Skip to main content

Command Palette

Search for a command to run...

Verifying swc minifier using dbg-swc

Updated
2 min read

Everyone wants a faster build. But the build time should never be the highest priority. There are many more important things - namely correctness and user experience. In this article, I'll describe a way to verify if the SWC minifier is better than the terser for your web application.

The SWC minifier is fast. Almost everyone reading this article will know. But there's a vast inherent problem with JavaScript minification tools. Changing the minifier is risky. Changing here includes updating. In other words, upgrading the terser may break your app in production This was a case for lots of people, including my colleague. So using the SWC minifier becomes something you want to avoid trying. And yes, I admit that there are bugs in the SWC minifier that no one knows.

If the SWC minifier makes your bundle larger, it's also a bug because it degrades the user experience. So it's also covered by the new tool.

Automatic reducing

But there's a way to check if the swc minifier will break your application without breaking the production. Also, You don't need to give me access to the source code. Additionally, you don't need to investigate the bug by yourself.

Today, I'm introducing dbg-swc, which can be used to verify SWC minifier for your application in a semi-automated way.

How it works

It uses creduce internally, a fantastic CLI tool to reduce an input file to have a minimal input file with the same property. It repeatedly tries the same operation after modifying the input slightly. The same operation here is the verification implemented by dbg-swc. Currently, there are two modes. Those are size and semantics. I'll describe them in the Usage section.

Installation

You need to install creduce to use the reducer. To install creduce, please see INSTALL.md

For dbg-swc itself, you can download a binary for your platform from https://github.com/swc-project/dbg-swc/releases After downloading one for your platform, rename it to dbg-swc, make it executable (chmod +x dbg-swc), and store it in your PATH.

Usage

If you want to find an input that the SWC minifier breaks, you can do

  • dbg-swc es minifier reduce --mode semantics path/to/file_or_dir

Disclaimer: This is not 100% correct verification.

If you want to verify that the SWC minifier does not emit a larger output than terser, you can run

  • dbg-swc es minifier reduce --mode size path/to/file_or_dir

Conclusion

A single investment can make long-term gains. I'd recommend running it against your application.

More from this blog

한국의 학벌에 대한 생각

내 블로그의 제목이 kdy1: The way I think 인만큼 앞으로는 내 생각을 더 자주 올리려고 한다. 한국 기준으로, 학벌은 사람을 볼 때 꽤나 유용한 지표이지만, 절대적이지는 않다. 경험적인 얘기일 뿐이지만, 성균관대학교 자퇴생으로서 느낀 것들이 몇 가지 있다. 대학까지 간 사람의 학벌은 학습 능력 x 성실함 에 대체로 비례한다. 그래서 의미가

Apr 3, 20261 min read

인간 지능에 대한 메모장

최종 업데이트: 2026/03/15 지능의 유전 현재 인류 기준으로, 고지능자는 고지능 유전자가 많이 겹친 사람이다. 지능의 유전엔 X 염색체가 매우 중요한 역할을 한다. 그리고 이게 남자와 여자의 지능 분포 차이를 만든다. 극상위권에 여자가 거의 없는 이유가 이것이다. 고지능 X 염색체가 여자한테서 발현되려면 2개가 있어야 한다. 이는 인간의 생

Mar 15, 20262 min read

Ai 코딩 팁 2 (한국어)

발표 자료: https://gamma.app/docs/AI--2a52e7tk3eb1ch1 AI 활용법 관련해서 간단하게 발표를 했다. 발표 자료 앞쪽은 전에 블로그에 올린 글이랑 같은 내용이다. 이 글에서는 기존 글에서 다루지 않은 내용들을 다루겠다. 에러 메시지 및 로깅 구체적 타입 및 스키마 활용 any 타입은 사람에게도 위험하지만, AI에게는 더 위험하다. 마찬가지로, JSON.parse처럼 아무 제약 없는 파싱 느슨한 인터페이스 ...

Jan 30, 20265 min read

kdy1: The way I think

233 posts