Skip to content

Oxc Minifier 알파


oxc-minify 알파 릴리스를 공개합니다.

고급 압축 기법 일부는 아직 없지만, 현재 버전만으로도 minification-benchmarks 기준으로 esbuild보다 성능과 압축 크기 모두 우수합니다.

typescript.js를 둘러싼 널리 쓰이는 미니파이어 비교:

ArtifactOriginal sizeGzip size
typescript v4.9.5 (Source)10.95 MB1.88 MB
MinifierMinified sizeMinzipped sizeTime
@swc/core🏆-70% 3.32 MB🏆-54% 858.29 kB5x2,179 ms
oxc-minify-69% 3.35 MB-54% 860.67 kB🏆 444 ms
terser (no compress)-68% 3.53 MB-53% 879.30 kB14x6,433 ms
esbuild-68% 3.49 MB-51% 915.55 kB1x492 ms
terser ❌ Timed out--⚠️ +10,000 ms

oxc-minify 사용 예시

typescript
import { minify } from "oxc-minify";

const filename = "test.js";
const code = "const x = 'a' + 'b'; console.log(x);";
const options = {
  compress: {
    target: "esnext",
  },
  mangle: {
    toplevel: false,
  },
  codegen: {
    removeWhitespace: true,
  },
  sourcemap: true,
};
const result = minify(filename, code, options);

console.log(result.code);
console.log(result.map);

다음 릴리스

oxc-minifyRolldown에 내장 미니파이어로 통합 중이며, Rolldown은 Vite의 미래가 될 예정입니다.

따라서 다음이 중요합니다.

  • 상수 인라이닝, 데드 코드 제거 같은 고급 압축 기법을 계속 구현할 것
  • 프로덕션 준비를 위해 테스트 인프라를 강화·확장할 것

감사의 말

미니파이어를 개선해 주신 @sapphi-red께 감사드립니다. 특히 esbuild에 없는 고급 심볼 압축 알고리즘 부분입니다.