rspack

使用 Rspack 打包 JavaScript/TypeScript 应用的工具:基于 Rust 的 webpack 替代方案,声称速度提升 5–10 倍。适用于希望“加速 webpack”或“替换 webpack”的场景,涵盖与 webpack 兼容性、配置、加载器、插件及从 webpack 迁移相关的内容。

仓库最近推送
GitHub Stars
219
Forks
38
Issues / PRs
7

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "rspack":https://skillpi.com/zh/skills/deepskill-6ca5ec20918f5bf63840c54973afb81f66919a1a02d029b61e64cbd63013a3c8。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

使用 Rspack 打包 JavaScript/TypeScript 应用的工具:基于 Rust 的 webpack 替代方案,声称速度提升 5–10 倍。适用于希望“加速 webpack”或“替换 webpack”的场景,涵盖与 webpack 兼容性、配置、加载器、插件及从 webpack 迁移相关的内容。

0 下载

介绍来源: third_party · TerminalSkills · 1.0.0 参考来源

SkillPi 解读

适合谁
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: rspack
description: >-
  Bundle JavaScript/TypeScript applications with Rspack — Rust-based webpack
  replacement that's 5-10x faster. Use when someone asks to "speed up webpack",
  "Rspack", "fast bundler", "Rust bundler for JavaScript", "replace webpack",
  "migrate from webpack", or "faster build times". Covers webpack compatibility,
  configuration, loaders, plugins, and migration from webpack.
license: Apache-2.0
compatibility: "Node.js 18+. Drop-in webpack replacement."
metadata:
  author: terminal-skills
  version: "1.0.0"
  category: devops
  tags: ["bundling", "rspack", "webpack", "rust", "build-tools"]

Rspack

Overview

Rspack is a Rust-based JavaScript bundler fully compatible with webpack — same config format, same loaders, same plugins, 5-10x faster builds. Created by ByteDance, it's a drop-in webpack replacement: rename your config file, install Rspack, and your existing webpack project builds in a fraction of the time. No config rewrite, no loader migration, no plugin hunting.

When to Use

  • Webpack builds taking too long (>30 seconds)
  • Want faster builds without rewriting config (unlike Vite migration)
  • Large enterprise projects with heavy webpack configs
  • Need webpack compatibility (loaders, plugins, config) with better performance
  • Migration from Create React App or webpack-based setups

Instructions

New Project

npm create rspack@latest my-app
cd my-app
npm start

Migrate from Webpack

# Install Rspack
npm install -D @rspack/core @rspack/cli

# Remove webpack
npm uninstall webpack webpack-cli webpack-dev-server
// rspack.config.js — Almost identical to webpack.config.js
const { defineConfig } = require("@rspack/cli");
const { HtmlRspackPlugin } = require("@rspack/core");

module.exports = defineConfig({
  entry: "./src/index.tsx",
  output: {
    path: "./dist",
    filename: "[name].[contenthash].js",
    clean: true,
  },
  resolve: {
    extensions: [".ts", ".tsx", ".js", ".jsx"],
    alias: { "@": "./src" },
  },
  module: {
    rules: [
      {
        test: /\.(ts|tsx)$/,
        use: {
          loader: "builtin:swc-loader",  // Built-in SWC — no babel needed
          options: {
            jsc: {
              parser: { syntax: "typescript", tsx: true },
              transform: { react: { runtime: "automatic" } },
            },
          },
        },
      },
      {
        test: /\.css$/,
        type: "css",  // Built-in CSS support
      },
      {
        test: /\.module\.css$/,
        type: "css/module",  // CSS Modules built-in
      },
      {
        test: /\.(png|jpg|svg|gif)$/,
        type: "asset",  // Built-in asset handling
      },
    ],
  },
  plugins: [
    new HtmlRspackPlugin({ template: "./index.html" }),
  ],
  devServer: {
    port: 3000,
    hot: true,
  },
});

Key Differences from Webpack

// What's built-in (no extra loaders/plugins needed):
// ✅ TypeScript/JSX via SWC — builtin:swc-loader
// ✅ CSS/CSS Modules — type: "css" / "css/module"
// ✅ Asset handling — type: "asset"
// ✅ HTML generation — HtmlRspackPlugin
// ✅ Code splitting — same as webpack
// ✅ Tree shaking — built-in
// ✅ Hot Module Replacement — built-in

// What still uses webpack loaders:
// ✅ sass-loader, less-loader — work as-is
// ✅ postcss-loader — works as-is
// ✅ Most webpack loaders — compatible

With React and Tailwind

// rspack.config.js — React + Tailwind CSS project
module.exports = {
  module: {
    rules: [
      {
        test: /\.(ts|tsx)$/,
        use: {
          loader: "builtin:swc-loader",
          options: {
            jsc: {
              parser: { syntax: "typescript", tsx: true },
              transform: { react: { runtime: "automatic" } },
            },
          },
        },
      },
      {
        test: /\.css$/,
        use: ["postcss-loader"],  // PostCSS processes Tailwind
        type: "css",
      },
    ],
  },
};

Examples

Example 1: Migrate a webpack project to Rspack

User prompt: "Our webpack build takes 60 seconds. Speed it up without rewriting the config."

The agent will install Rspack, adapt the existing webpack.config.js (minimal changes), replace babel-loader with builtin:swc-loader, and benchmark the improvement.

Example 2: Set up a new React project with Rspack

User prompt: "Create a new React + TypeScript project with fast builds."

The agent will scaffold an Rspack project with SWC for TypeScript/JSX, CSS Modules, asset handling, and dev server with HMR.

Guidelines

  • Drop-in webpack replacement — same config format, most loaders work
  • builtin:swc-loader — replaces babel-loader, 20x faster transpilation
  • type: "css" — no css-loader/style-loader needed
  • type: "asset" — no file-loader/url-loader needed
  • Most webpack plugins work — check @rspack/compat for compatibility layer
  • HMR is built-in — faster than webpack's HMR
  • Tree shaking built-in — no extra config needed
  • 5-10x faster — Rust parallelism beats single-threaded JS
  • Production-ready — used by ByteDance at scale
  • @rspack/cli — provides rspack serve and rspack build commands

当前收录版本

1.0.0

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值85/100

亮点

  • Rspack 作为 webpack 的 Rust 替代方案,显著提升构建速度,解决前端开发中的实际痛点
  • 适用于 webpack 迁移、新项目搭建等多种高频场景,实用价值高
触发精准90/100

亮点

  • 触发词覆盖全面,包括“加速 webpack”、“Rspack”、“快速打包工具”等,边界清晰
  • 能有效匹配用户关于构建优化的多样化表达
结构规范95/100

亮点

  • 文档结构完整,包含使用场景、迁移步骤、配置示例和端到端案例
  • frontmatter 信息齐全,排版规范,易于理解
执行可靠90/100

亮点

  • 提供具体安装命令和配置示例,工具来源明确
  • 覆盖常见迁移场景,步骤清晰,执行风险低
证据可验 (前四项均值)90/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

  • 安装或获取外部依赖

    使用官方来源并锁定版本,在隔离环境检查安装脚本。当前文档检查不覆盖后续下载的代码。

    主文档提及 · 第 46 行

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。