next-rspack

维护 @next/rspack-core 和 @next/rspack-binding 包。用于编辑 rspack/package.json、rspack/crates/binding/Cargo.toml、rspack/rust-toolchain.toml 或 packages/next-rspack/package.json 时的工作流程。涵盖升级 @rspack/core npm 版本、rspack_* crate 版本、Rust 工具链版本、本地测试的构建与链接,以及 NEXT_RSPACK 环境变量的使用。不适用于根目录的 rust-toolchain.toml(那是用于 Turbopack 的)。元数据:internal: true

仓库最近推送
GitHub Stars
143,631
Forks
32,732
Issues / PRs
4,112

预览截图

来自skillπ 实验室的展示

安装方式

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

用 AI 助手安装

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

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

来源与配置

github.com

配置方式待核实

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

安装实测待补充

维护 @next/rspack-core 和 @next/rspack-binding 包。用于编辑 rspack/package.json、rspack/crates/binding/Cargo.toml、rspack/rust-toolchain.toml 或 packages/next-rspack/package.json 时的工作流程。涵盖升级 @rspack/core npm 版本、rspack_* crate 版本、Rust 工具链版本、本地测试的构建与链接,以及 NEXT_RSPACK 环境变量的使用。不适用于根目录的 rust-toolchain.toml(那是用于 Turbopack 的)。元数据:internal: true

0 下载

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

SkillPi 解读

能完成的任务
需要时使用此技能:
适合谁
需要时使用此技能: 升级 `@rspack/core` npm 软件包版本 升级 rspack 箱子依赖性版本 升级 Rust 版本 `rspack/rust-toolchain.toml` (只有rspack目录) Fix Rspack相关编译问题 在Next.js QQ范围限制中开发 Rspack 特定功能**: 此技能仅适用于以下的代码和配置: `rspack/` 目录。 那个 `rust-toolchain.toml` 在寄存器根中是用于涡轮包装的,并且不属于这种技能的范围.
输入和输出
来源文档未说明。
软件、账号及付费要求
来源文档未说明。
限制与区别
来源文档未说明。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: next-rspack
description: >
  Maintain @next/rspack-core and @next/rspack-binding packages. Use when editing
  rspack/package.json, rspack/crates/binding/Cargo.toml, rspack/rust-toolchain.toml,
  or packages/next-rspack/package.json. Covers upgrading @rspack/core npm version,
  rspack_* crate versions, Rust toolchain version, building and linking for local
  testing, and NEXT_RSPACK environment variable usage. Does NOT apply to root
  rust-toolchain.toml (that's for Turbopack).
metadata:
  internal: true

Next.js with Rspack

When to Use

Use this skill when you need to:

  • Upgrade @rspack/core npm package version
  • Upgrade rspack crate dependency versions
  • Upgrade Rust version in rspack/rust-toolchain.toml (rspack directory only)
  • Fix Rspack-related compilation issues
  • Develop Rspack-specific features in Next.js

⚠️ Scope Limitation: This skill only applies to code and configuration under the rspack/ directory. The rust-toolchain.toml in the repository root is for Turbopack and is outside the scope of this skill.

Architecture Overview

Package Structure

rspack/                          # Independent workspace (separate rust toolchain and npm releases)
├── Cargo.toml                   # Rust workspace configuration
├── rust-toolchain.toml          # Rust version configuration
├── package.json                 # @next/rspack-core package definition
├── lib/
│   ├── index.js                 # Exports @rspack/core + custom plugins
│   └── index.d.ts               # Type definitions
└── crates/
    └── binding/
        ├── Cargo.toml           # Rust crate dependencies (rspack_* crates)
        └── package.json         # @next/rspack-binding package definition

packages/
└── next-rspack/
    └── package.json             # References @next/rspack-core

Dependency Graph

packages/next-rspack
    └── @next/rspack-core (rspack/package.json)
            ├── @rspack/core (npm dependency)
            └── @next/rspack-binding (rspack/crates/binding)
                    └── rspack_* crates (Cargo.toml dependencies)

Version Mapping Rules

@rspack/core npm version rspack crate version Notes
2.0.0-rc.0 0.100.0-rc.0 npm major.minor maps to crate 0.(major*50+minor)
1.3.x 0.53.x e.g., 1.3 → 0.53
1.2.x 0.52.x e.g., 1.2 → 0.52

Upgrade Process

Step 1: Get Upstream Version Information

Query https://github.com/web-infra-dev/rspack to obtain:

  • Target @rspack/core npm version
  • Corresponding rspack crate version
  • Rust channel version from rust-toolchain.toml

Step 2: Update npm Dependencies

Edit rspack/package.json:

{
  "dependencies": {
    "@rspack/core": "<new version>",
    "@next/rspack-binding": "workspace:*"
  }
}

Step 3: Update Cargo.toml

Edit rspack/crates/binding/Cargo.toml, update all rspack crate versions:

[dependencies]
rspack_binding_builder        = { version = "=<new crate version>" }
rspack_binding_builder_macros = { version = "=<new crate version>" }
rspack_core                   = { version = "=<new crate version>" }
rspack_error                  = { version = "=<new crate version>" }
rspack_hook                   = { version = "=<new crate version>" }
rspack_plugin_externals       = { version = "=<new crate version>" }
rspack_regex                  = { version = "=<new crate version>" }
# rspack_sources version is managed separately, may not follow the main version

[target.'cfg(...)'.dependencies]
rspack_binding_builder = { version = "=<new crate version>", features = ["plugin"] }

[build-dependencies]
rspack_binding_build = { version = "=<new crate version>" }

Step 4: Update Rust Toolchain

Edit rspack/rust-toolchain.toml:

[toolchain]
profile = "default"
components = ["rust-src"]
channel = "<nightly version matching upstream rspack>"

Step 5: Verify Build

# Execute in rspack directory
cd rspack

# Check Rust code
cargo check

# Build binding (requires Rust installed)
pnpm build

Step 6: Link to packages/next-rspack

rspack/ is an independent workspace not included in the root pnpm-workspace, manual linking is required:

# Execute from repository root
cd packages/next-rspack

# Link locally built @next/rspack-core
pnpm link ../../rspack

Or modify packages/next-rspack/package.json to use local path (for local testing only, do not commit):

{
  "dependencies": {
    "@next/rspack-core": "link:../../rspack"
  }
}

Important: After linking, run pnpm install in the root directory to update dependency relationships.

Step 7: Run Tests

# Execute from repository root
pnpm test-rspack

Key Files Checklist

Files to check/modify during upgrade:

File Path Modification
rspack/package.json @rspack/core version, package version
rspack/crates/binding/Cargo.toml rspack_* crate versions
rspack/crates/binding/package.json binding package version
rspack/rust-toolchain.toml Rust nightly version
packages/next-rspack/package.json @next/rspack-core version reference (update on release, use link for local testing)

Pre-requisites for Local Testing

Before running pnpm test-rspack, you must build and link @next/rspack-core:

# 1. Build @next/rspack-core
cd rspack
pnpm install
pnpm build

# 2. Link to packages/next-rspack
cd ../packages/next-rspack
pnpm link ../../rspack

# 3. Return to root and update dependencies
cd ../..
pnpm install

# 4. Run tests
pnpm test-rspack

Note: After modifying Rust code under rspack/, you need to re-run pnpm build from step 1.

Test Commands

# Full test suite (using Rspack compiler)
pnpm test-rspack

# Development mode tests
pnpm test-dev-rspack

# Production mode tests
pnpm test-start-rspack

# Run specific tests only
pnpm run with-rspack pnpm testonly -- <test-pattern>

All test commands set environment variables via with-rspack:

cross-env NEXT_RSPACK=1 NEXT_TEST_USE_RSPACK=1

Development Notes

Environment Variable Differentiation

Use the NEXT_RSPACK environment variable to differentiate compilers in packages/next/ code:

// Check if using Rspack
const isRspack = Boolean(process.env.NEXT_RSPACK)

if (process.env.NEXT_RSPACK) {
  // Rspack-specific logic
} else {
  // Webpack logic
}

Common Code Locations

  • Compiler selection logic: packages/next/src/lib/bundler.ts
  • Webpack configuration: packages/next/src/build/webpack-config.ts
  • Loader adaptations: packages/next/src/build/webpack/loaders/

Custom Plugins

@next/rspack-core exports = @rspack/core + custom plugins:

  • NextExternalsPlugin - externals handling plugin implemented in Rust

Release Process

Release via GitHub Actions workflow:

  • Workflow: .github/workflows/release-next-rspack.yml
  • Supports dry-run mode
  • Supports multiple npm tags (latest, alpha, beta, canary)

References

当前收录版本

1.0.0

核对来源版本 ↗

安全与评测信息

质量评测

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

场景价值95/100

亮点

  • 高价值/高频刚需 - 维护 Next.js Rspack 核心包,解决版本升级、构建、测试等明确痛点
触发精准90/100

亮点

  • 触发词精准完整,覆盖多种变体,边界清晰
结构规范90/100

亮点

  • Phase/步骤清晰,有出口条件,含端到端示例,frontmatter完整
执行可靠90/100

亮点

  • 工具来源明确,参数正确,覆盖主要异常,不可逆操作有确认机制
证据可验 (前四项均值)91/100

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

正文静态检测

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

正文未命中当前规则。

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

权限与使用前检查

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

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

文档引用的域名或地址

这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。

  • github.com
  • rspack.rs

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

安全评级与访问范围

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

来源文档未说明。

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