Skip to content

The module uses inconsistent export syntax #315

@simon-abbott

Description

@simon-abbott

The module is using exports.default with exports.__esModule, but it's not setting module.exports directly. This is causing a behavior difference between Node.js and most bundlers when using ESM.

import cron from 'cron-validate';

// This works in Node, but fails in most bundlers
cron.default('').isValid();

// This works in bundlers, but throws 'TypeError: cron is not a function' when
// run in Node (and also causes TypeScript to complain)
cron('').isValid();

For more details see:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions