Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Rspack - GitHub Copilot Instructions

## Project Overview

Rspack is a high-performance JavaScript bundler written in Rust that offers strong compatibility with the webpack ecosystem. It provides lightning-fast build speeds while allowing seamless replacement of webpack in existing projects.

## Project Architecture

This is a **monorepo** containing both Rust crates and JavaScript packages:

### Rust crates (`crates/`)

- **Core Engine**: Written in Rust for performance
- **Plugins**: Extensive plugin system (css, javascript, html, etc.)
- **Bindings**: Node.js bindings through NAPI
- **Utilities**: Support crates for paths, collections, macros, etc.

### NPM packages (`packages/`)

- **CLI Tools**: Command-line interface and tooling
- **API Wrappers**: JavaScript APIs wrapping Rust core
- **Test Tools**: Testing utilities and frameworks
- **Create Tools**: Project scaffolding tools

## Development Environment

### Prerequisites

- **Rust**: Uses nightly toolchain (see `rust-toolchain.toml`)
- **Node.js**: 22+
- **pnpm**: enforced in `package.json

### Key Commands

```bash
# Build Rust bindings (development)
pnpm run build:binding:dev

# Build JavaScript packages
pnpm run build:js

# Full development build
pnpm run build:cli:dev

# Run tests
pnpm run test:unit # JavaScript unit tests
pnpm run test:e2e # E2E tests
pnpm run test:webpack # webpack compatibility tests

# Linting
pnpm run lint:js # Linting with Biome
pnpm run lint:type # Type checking with Rslint
```

### File Organization

```
rspack/
├── crates/ # Rust source code
├── packages/ # JavaScript packages
├── tests/ # Integration tests
│ ├── webpack-test/ # Webpack compatibility tests
│ ├── e2e/ # E2E tests
│ └── bench/ # Benchmarking
└── website/ # Documentation site
```

## Contributing Guidelines

- Follow existing code patterns and conventions
- Add tests for new features
- Update documentation when changing APIs
- Run all linters and tests before submitting
- Use conventional commit messages
- Keep PRs focused and atomic
Loading