Skip to content

Bug: @payloadcms/live-preview client functions import backend-only payload/shared #15024

@NicolasdRa

Description

@NicolasdRa

Describe the Bug

The @payloadcms/live-preview package is designed for use in frontend projects to build custom hooks (per https://payloadcms.com/docs/live-preview/client). However, starting around version 3.60.0 to 3.69.0, the package imports from payload/shared:

  // dist/mergeData.js
  import { formatAdminURL } from "payload/shared";

This breaks all non-Next.js frontend projects (SolidJS, Vue, Svelte, plain Vite+React) because payload is not installed and shouldn't be required for client-side live preview.

Link to the code that reproduces this issue

https://github.com/NicolasdRa/payload-live-preview-bug

Reproduction Steps

Affected Use Case

Building a custom useLivePreview hook for SolidJS using subscribe, unsubscribe, and ready functions - exactly as documented in https://payloadcms.com/docs/live-preview/client.

Steps to Reproduce

  1. Create a SolidStart/Vite project
  2. npm install @payloadcms/[email protected]
  3. Dynamic import: await import("@payloadcms/live-preview")
  4. Error: Failed to resolve import "payload/shared"

Workaround

Downgrade to @payloadcms/[email protected]

Which area(s) are affected?

area: live-preview

Environment Info

Binaries:
  Node: 24.11.1
  npm: 11.6.2
  Yarn: N/A
  pnpm: 10.18.3
Relevant Packages:
  payload: 3.68.5
  next: 15.4.10
  @payloadcms/db-postgres: 3.68.5
  @payloadcms/drizzle: 3.60.0
  @payloadcms/email-nodemailer: 3.68.5
  @payloadcms/graphql: 3.60.0
  @payloadcms/live-preview: 3.60.0
  @payloadcms/live-preview-react: 3.68.5
  @payloadcms/next/utilities: 3.68.5
  @payloadcms/payload-cloud: 3.68.5
  @payloadcms/plugin-cloud-storage: 3.68.5
  @payloadcms/plugin-form-builder: 3.68.5
  @payloadcms/plugin-multi-tenant: 3.68.5
  @payloadcms/plugin-nested-docs: 3.68.5
  @payloadcms/plugin-redirects: 3.68.5
  @payloadcms/plugin-search: 3.68.5
  @payloadcms/plugin-seo: 3.68.5
  @payloadcms/richtext-lexical: 3.68.5
  @payloadcms/storage-s3: 3.68.5
  @payloadcms/translations: 3.68.5
  @payloadcms/ui/shared: 3.68.5
  react: 19.1.4
  react-dom: 19.1.4
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.1.0: Mon Oct 20 19:32:41 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T6000
  Available memory (MB): 32768
  Available CPU cores: 8

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs-triagePossible bug which hasn't been reproduced yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions