Skip to content

ESM-only packages in snapshot-libs.js require manual removal with no guardrail #307

Description

@philip-peterson

Issue written by Claude:

Problem

This is now the second manual removal of an ESM-only package from bin/snapshot-libs.js:

  • f3e0d352 removed color-convert and color-string
  • The recent Fixes commits removed open

The pattern will repeat with every dependency that upgrades from CJS to ESM. Each time, pnpm install silently succeeds but the snapshot build fails at runtime with:

SyntaxError: Cannot use import statement outside a module

Root cause

bin/mk-snapshot.js already has a shouldExcludeModule callback with an empty excludedModules map — the right hook to auto-filter ESM-only packages. It is never populated.

Suggested fix

At snapshot build time, walk the node_modules of each entry in snapshot-libs.js and auto-exclude any package whose package.json declares "type": "module", rather than waiting for the failure and removing entries by hand.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions