Skip to content

Build issue for scheduler import, with Vite #289

@ajmas

Description

@ajmas

The documentation indicates the following for the import for the scheduler:

import { IntervalBasedCronScheduler as scheduler } from 'cron-schedule/schedulers/interval-based.js'

Though when I do this in VS Code it says it cant' find it. The following works though, but then breaks in execution of the app:

import { IntervalBasedCronScheduler as scheduler } from 'cron-schedule/dist/schedulers/interval-based.js'

Originally I though this was a documentation issue, but now I am wondering whether the packaging has some issues, since if I use cron-schedule/schedulers/interval-based.js dev runtime works, build build time fails.

Error output:

src/views/MagicScreen.vue:45:54 - error TS2307: Cannot find module 'cron-schedule/schedulers/timer-based.js' or its corresponding type declarations.

45 import { TimerBasedCronScheduler as scheduler } from 'cron-schedule/schedulers/timer-based.js';
                                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

My import is presented as follows in my Vue file:

import { parseCronExpression } from 'cron-schedule';
import { TimerBasedCronScheduler as scheduler } from 'cron-schedule/schedulers/timer-based.js';

I am using Vite 3.2.3 for packaging.

Looking at issue #284, but yarn add [email protected] -S didn't change anything.

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