Shopify CLI Docs

shopify hydrogen preview

Runs a server in your local development environment that serves your Hydrogen app's production build. Requires running the build(https://shopify.dev/docs/a

Runs a server in your local development environment that serves your Hydrogen app's production build. Requires running the build command first.

Usage

shopify hydrogen preview [flags]

Summary

Runs a server in your local development environment that serves your Hydrogen app's production build. Requires running the build command first.

Flags

  • --build — Builds the app before starting the preview server. optional
  • --codegen — Automatically generates GraphQL types for your project’s Storefront API queries. optional
  • --codegen-config-path <value> string — Specifies a path to a codegen configuration file. Defaults to <root>/codegen.ts if this file exists. optional
  • --debug — Enables inspector connections to the server with a debugger such as Visual Studio Code or Chrome DevTools. optional Environment: SHOPIFY_HYDROGEN_FLAG_DEBUG.
  • --entry <value> string — Entry file for the worker. Defaults to ./server. optional Environment: SHOPIFY_HYDROGEN_FLAG_ENTRY.
  • --env <value> string — Specifies the environment to perform the operation using its handle. Fetch the handle using the env list command. optional
  • --env-branch <value> string — Specifies the environment to perform the operation using its Git branch name. optional Environment: SHOPIFY_HYDROGEN_ENVIRONMENT_BRANCH.
  • --env-file <value> string — Path to an environment file to override existing environment variables. Defaults to the '.env' located in your project path --path. optional
  • --inspector-port <value> string — The port where the inspector is available. Defaults to 9229. optional Environment: SHOPIFY_HYDROGEN_FLAG_INSPECTOR_PORT.
  • --path <value> string — The path to the directory of the Hydrogen storefront. Defaults to the current directory where the command is run. optional Environment: SHOPIFY_HYDROGEN_FLAG_PATH.
  • --port <value> string — The port to run the server on. Defaults to 3000. optional Environment: SHOPIFY_HYDROGEN_FLAG_PORT.
  • --verbose — Outputs more information about the command's execution. optional Environment: SHOPIFY_HYDROGEN_FLAG_VERBOSE.
  • --watch — Watches for changes and rebuilds the project. optional

Official source

On this page