# @utoo/pack

> > 🌖 High-performance bundler core for the Utoo toolchain, powered by [Turbopack](https://turbo.build/pack).

Latest version **1.5.18** (published 2026-09-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @utoo/pack
pnpm add @utoo/pack
yarn add @utoo/pack
bun add @utoo/pack
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.5.18 |
| Published | 2026-09-15 |
| First published | 2025-06-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 20 |
| Dependencies | 16 |
| Unpacked size | 449.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 2544 |
| Maintainers | afc163, elrrrrrrr, xusd320, zoomdong07 |

## Links

- npm: https://www.npmjs.com/package/@utoo/pack
- Repository: https://github.com/utooland/utoo
- Homepage: https://github.com/utooland/utoo#readme
- Issues: https://github.com/utooland/utoo/issues
- npm.io page: https://npm.io/package/@utoo/pack

## Dependencies (16)

- [ws](https://npm.io/package/ws.md) ^8.18.1
- [hono](https://npm.io/package/hono.md) ^4.12.5
- [send](https://npm.io/package/send.md) 0.17.1
- [nanoid](https://npm.io/package/nanoid.md) ^3.3.11
- [semver](https://npm.io/package/semver.md) ^7.7.1
- [find-up](https://npm.io/package/find-up.md) 4.1.0
- [get-port](https://npm.io/package/get-port.md) 5.1.1
- [picocolors](https://npm.io/package/picocolors.md) ^1.1.1
- [@swc/helpers](https://npm.io/package/@swc/helpers.md) 0.5.15
- [browserslist](https://npm.io/package/browserslist.md) ^4.28.5
- [domparser-rs](https://npm.io/package/domparser-rs.md) ^0.0.7
- [@hono/node-ws](https://npm.io/package/@hono/node-ws.md) ^1.3.0
- [@babel/code-frame](https://npm.io/package/@babel/code-frame.md) 7.22.5
- [@hono/node-server](https://npm.io/package/@hono/node-server.md) ^1.19.11
- [@utoo/pack-shared](https://npm.io/package/@utoo/pack-shared.md) 1.5.18
- [@jridgewell/trace-mapping](https://npm.io/package/@jridgewell/trace-mapping.md) ^0.3.31

## Recent versions

- 1.5.18 (latest) — 2026-09-15
- 1.5.19-alpha.1 (alpha) — 2026-09-16
- 1.2.10-rc.2 (rc) — 2026-02-28
- 1.1.7-lingguang (lingguang) — 2025-12-22
- 1.5.19-alpha.0 — 2026-09-15
- 1.5.18-alpha.0 — 2026-09-14
- 1.5.17 — 2026-09-11
- 1.5.17-alpha.1 — 2026-09-11
- 1.5.17-alpha.0 — 2026-09-09
- 1.5.16 — 2026-09-08
- 1.5.15 — 2026-09-04
- 1.5.14 — 2026-09-02
- 1.5.14-alpha.1 — 2026-09-02
- 1.5.14-alpha.0 — 2026-09-02
- 1.5.13 — 2026-08-31
- … 317 more at https://npm.io/package/@utoo/pack/versions

## README

# @utoo/pack

> 🌖 High-performance bundler core for the Utoo toolchain, powered by [Turbopack](https://turbo.build/pack).

`@utoo/pack` is the engine behind the Utoo build system. It leverages the incremental computation power of Turbopack and the performance of Rust to provide a lightning-fast development and build experience.

## ✨ Key Features

- ⚡ **Extreme Performance**: Core bundling logic implemented in Rust via NAPI-RS.
- 🛠️ **Turbopack Powered**: Built on top of the same engine that powers Next.js Turbopack.
- 🔌 **Webpack Compatibility**: Support for consuming `webpack.config.js` to simplify migration from Webpack.
- 📦 **Modern Web Support**: Native support for TypeScript, JSX, CSS Modules, Less, Sass, and more.
- 🔧 **Extensible Architecture**: Support for custom loaders, plugins, and flexible configuration.
- 🔄 **Fast HMR**: Instant updates during development with optimized Hot Module Replacement.

## ✨ Supported Features

`@utoo/pack` aims for high compatibility with the Webpack ecosystem while providing superior performance.

- **Entry**: Supports `name`, `import`, and `filename` templates.
- **Module Rules**: Support for most mainstream Webpack loaders via `loader-runner`.
- **Resolve**: Full support for `alias` and `extensions`.
- **Styles**: Built-in support for Less, Sass, PostCSS, CSS Modules, and LightningCSS.
- **Optimization**: Minification, Tree Shaking, Module Concatenation, and more.
- **Frameworks**: Optimized for React (including `styled-jsx`, `styled-components`).
- **Tools**: Integrated Bundle Analyzer and Tracing Logs.

> [!TIP]
> For a detailed status of all features, see the [Features List](./docs/features-list.md).

## 📦 Installation

```bash
ut install @utoo/pack --save-dev
```

## 🚀 Quick Start

### Programmatic API

You can use `@utoo/pack` directly in your Node.js scripts:

```javascript
const { build, dev } = require('@utoo/pack');

// Production build
async function runBuild() {
  await build({
    config: {
      entry: [
        {
          import: "./src/index.ts",
          html: {
            template: "./index.html"
          }
        }
      ],
      output: {
        path: "./dist",
        filename: "[name].[contenthash:8].js",
        chunkFilename: "[name].[contenthash:8].js",
        clean: true
      },
      sourceMaps: true
    }
  });
}

// Development mode with HMR
async function startDev() {
  const server = await dev({
    config: {
      entry: [
        {
          import: "./src/index.ts",
          html: {
            template: "./index.html"
          }
        }
      ],
      output: {
        path: "./dist",
        filename: "[name].[contenthash:8].js",
        chunkFilename: "[name].[contenthash:8].js",
        clean: true
      },
      sourceMaps: true
    }
  });
}
```

## 🔌 Webpack Compatibility Mode

`@utoo/pack` provides a partial compatibility layer for Webpack.

```javascript
const { build } = require('@utoo/pack');
const webpackConfig = require('./webpack.config.js');

async function run() {
  await build({ ...webpackConfig, webpackMode: true });
}
```

> [!NOTE]
> Not all Webpack features and plugins are supported. Check the [Features List](./docs/features-list.md) for details on supported configuration options.

## ⚙️ Configuration

The bundler can be configured via a `utoopack.json` or through the programmatic API. Key configuration areas include:

- **`entry`**: Define your application entry points.
- **`define`**: Build-time variable replacement.
- **`externals`**: Exclude specific dependencies from the bundle.
- **`server.externals`**: Replace top-level externals for server entries and Server Functions. If
  omitted, server builds continue to use top-level `externals`.
- **`devServer.browserToTerminal`**: Forward browser console output to the development terminal.
  Use `"error"`, `"warn"`, `true`, or `false`; standalone Utoopack defaults to `false`.
- **`mode`**: `development` or `production`.

For a full list of options, see the [Configuration Schema](./config_schema.json).

Production client builds default to short content-hashed JS and CSS chunk names,
using Turbopack's 13-character base38 hash (for example, `<hash>.js` or
`turbopack-<hash>.js` for entry runtimes). Development builds retain readable names.
Explicit `output.filename`, `output.chunkFilename`, and `output.cssFilename`
templates take precedence; use `filename: "[name].js"` when consumers require
stable entry filenames. Static assets, copied files, server builds, and library
builds keep their existing naming rules. A deployment's complete URL also includes
its public path and any query parameters, so short chunk names alone do not
guarantee a particular URL length limit.

## 🛠️ Development

### Prerequisites

- **Rust**: Nightly toolchain (see [rust-toolchain.toml](../../rust-toolchain.toml)).
- **Node.js**: Version 20 or higher.

### Building from Source

```bash
# Build Rust bindings and TypeScript modules
npm run build
```

## 📄 License

[MIT](./LICENSE)

---
_Source: https://npm.io/package/@utoo/pack · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
