Skip to content

compilePackages: dayjs throws ReferenceError: arguments is not defined at runtime #5133

Description

@proggeramlug

Perry: origin/main @ a674b6e (v0.5.1167) · macOS arm64
Setup: package compiled natively via perry.compilePackages (perry.allow.compilePackages: ["*"])
Build/run: perry repro.ts -o out && ./out

(Found via an internal real-package stress run — importing the real package and exercising it.)

Bug

Importing dayjs and calling .format()/.add()/.diff() throws ReferenceError: arguments is not defined. Plain arguments usage in a normal function/method works in Perry (verified), so the trigger is a specific form dayjs compiles to (likely arguments inside a nested/arrow/UMD-wrapped function where the binding is lost).

Repro

import dayjs from 'dayjs';

const d = dayjs('2026-06-14');
console.log(d.format('YYYY-MM-DD'), d.add(30, 'day').format('YYYY-MM-DD'), d.diff(dayjs('2026-01-01'), 'day'));

Expected (Node)

2026-06-14 2026-07-14 164

Actual (Perry)

ReferenceError: arguments is not defined

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed defect or regressionparityCompatibility gap with Node.js, ECMAScript, or the supported ecosystem

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions