• English
  • preview

    The rs preview command uses Rsbuild to preview an application's production build locally.

    Usage

    rs preview [options]

    The command loads the application configuration registered with define.app(). Run rs build before starting the preview server to generate the production output:

    rs build
    rs preview

    rs preview is intended for local preview only. Do not use it as a production server.

    Options

    rs preview supports the same preview server options as Rsbuild. See the Rsbuild CLI documentation for details.

    Examples:

    # Start the preview server and open the page in the browser
    rs preview --open
    
    # Use port 8080 and fail if it is already in use
    rs preview --port 8080 --strict-port
    
    # Make the preview server available on the local network
    rs preview --host

    Configuration

    Configure the preview server through define.app() in the Rstack configuration file. It accepts the standard Rsbuild configuration:

    rstack.config.ts
    import { define } from 'rstack';
    
    define.app({
      server: {
        open: true,
        port: 8080,
      },
    });