Skip to content

[C17] react: 'use client' directives are stripped from the published bundle #14

Description

@GFier

From the 2026-07-06 codebase audit (docs/audits/codebase-audit-2026-07-06.md, in-repo). Finding IDs are stable — cite them in fixes.

Severity: High · Status: CONFIRMED

Problem

All six client source files start with 'use client'; the shipped dist/elastica-react.mjs contains zero occurrences (verified by grep). Rollup drops module-level directives when bundling unless preserved via output.banner or a directives plugin (packages/react/rollup.config.js does neither).

Failure scenario

A Next.js App Router user — the primary consumer profile for this org — imports { DomElastica } in a server component (the natural first attempt): createContext is not a function / "only works in Client Components", with no hint that the library was supposed to declare the boundary itself.

Direction

output.banner: "'use client';" on the react bundle (or rollup-plugin-preserve-directives), plus a bundle grep in CI once CI exists (see the CI issue). Verify the fix by checking the built artifact, not the source.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    auditFinding from a codebase auditbugSomething isn't workinghighHigh severityreactpackages/react

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions