next-rspack
Screenshots
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "next-rspack" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-9a411e4a4f8fcdfd7ef90739e84c1958a58d9a589e4f0b4281d85840f8b82c7d. Verify the upstream source and version against https://github.com/vercel/next.js before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Maintenance workflow for the @next/rspack-core and @next/rspack-binding packages. Used when editing rspack/package.json, rspack/crates/binding/Cargo.toml, rspack/rust-toolchain.toml, or packages/next-rspack/package.json. Covers bumping @rspack/core npm versions, rspack_* crate versions, the Rust toolchain version, local build-and-link testing, and use of the NEXT_RSPACK environment variable. Not applicable to the root rust-toolchain.toml (that is for Turbopack). Metadata: internal: true
Introduction source: third_party · vercel · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Use this skill when you need to:
- Audience
- 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.
- Inputs and outputs
- Not specified in the source documentation.
- Software, accounts and paid services
- Not specified in the source documentation.
- Limits and differences
- Not specified in the source documentation.
- Testing
- Not tested
Browse files
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: trueNext.js with Rspack
When to Use
Use this skill when you need to:
- Upgrade
@rspack/corenpm 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. Therust-toolchain.tomlin 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/corenpm 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 installin 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-runpnpm buildfrom 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
- Upstream Rspack repository: https://github.com/web-infra-dev/rspack
- Rspack documentation: https://rspack.rs
- Next.js with Rspack example:
examples/with-rspack/
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 高价值/高频刚需 - 维护 Next.js Rspack 核心包,解决版本升级、构建、测试等明确痛点
Highlights
- 触发词精准完整,覆盖多种变体,边界清晰
Highlights
- Phase/步骤清晰,有出口条件,含端到端示例,frontmatter完整
Highlights
- 工具来源明确,参数正确,覆盖主要异常,不可逆操作有确认机制
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- github.com
- rspack.rs
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Not specified in the source documentation.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.