Skip to content

--template does not resolve pnpm catalog: references before uploading to StackBlitz #489

@alexprudhomme

Description

@alexprudhomme

Problem

When using --template with pkg-pr-new publish --pnpm, the template's package.json is copied verbatim to StackBlitz. If the template uses pnpm's catalog: protocol for dependencies, those references are not resolved — even though --pnpm correctly resolves catalog: in the published packages themselves.

This means any template that lives inside a pnpm workspace and uses catalog: will break in StackBlitz because the catalog: protocol has no meaning outside the workspace.

Example

Our CI command:

pnpm dlx pkg-pr-new publish --pnpm \
  --template './samples/pkg-new-template' \
  './packages/atomic' \
  './packages/headless'

Our template's package.json:

{
  "devDependencies": {
    "vite": "catalog:"
  }
}

The published packages correctly have catalog: resolved to real versions. But the template is copied as-is, so StackBlitz sees "vite": "catalog:" and fails to install.

Expected behavior

--template should resolve catalog: (and catalog:<name>) references in the template's package.json before uploading to StackBlitz, the same way --pnpm resolves them for published packages.

Current workaround

We run a script before pkg-pr-new publish that reads pnpm-workspace.yaml and replaces catalog: entries in the template's package.json with resolved versions.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions