API reference
Rstack provides a unified configuration API and re-exports the public APIs of Rsbuild, Rslib, Rstest, and Rslint through dedicated subpaths. Prefer these subpaths to direct imports from each tool's core package so that dependency entry points and tool versions remain aligned with Rstack.
Import paths
Main entry point
define
Import define from rstack to register tool configurations in rstack.config.ts; see Configuration APIs for details.
Re-exports
The tool-specific subpaths below re-export the public APIs from their corresponding core packages. Using these Rstack entry points keeps dependency entry points and tool versions aligned with the toolchain integrated by Rstack.
rstack/app
rstack/app re-exports all public APIs from @rsbuild/core, including APIs for creating and controlling Rsbuild instances.
For details, see the Rsbuild core APIs.
rstack/lib
rstack/lib re-exports all public APIs from @rslib/core, including APIs for creating Rslib instances and merging Rslib configurations.
For details, see the Rslib core APIs.
rstack/test
rstack/test re-exports all public APIs from @rstest/core, including APIs for defining tests, writing assertions, mocking modules, and merging test configurations.
See the Rstest runtime API for test APIs and the Rstest core APIs for configuration helpers.
For more guidance on testing, see Testing.
rstack/lint
rstack/lint re-exports all public APIs from @rslint/core, including JavaScript and TypeScript presets and framework plugins.
For details about the available presets and plugins, see Rslint rules and presets.
TypeScript types
These type-only entry points add ambient declarations to a TypeScript project. Add only the entries your project needs to compilerOptions.types in tsconfig.json.
rstack/types
rstack/types provides project-level declarations shared by Rsbuild and Rslib, including types for import.meta.env and static asset imports. Use it in place of @rsbuild/core/types or @rslib/core/types.
rstack/test/globals
rstack/test/globals declares Rstest APIs such as test, expect, and lifecycle hooks as globals. Add it when Rstest's globals option is enabled and tests use these APIs without explicit imports.
rstack/test/importMeta
rstack/test/importMeta augments ImportMeta with the optional rstest property, providing type support for import.meta.rstest in in-source tests.