Skip to content

Error when installing @worktile/gantt library on Angular due to missing exports from date-fns #544

@NguyenVanThanh139

Description

@NguyenVanThanh139

I am encountering issues when installing the @worktile/gantt library in my Angular project. The error messages indicate that certain exports from date-fns/locale are missing. Specifically, the following errors are being thrown during compilation:

[ERROR] TS2694: Namespace '"date-fns/locale"' has no exported member 'Locale'. [plugin angular-compiler]

node_modules/@worktile/gantt/i18n/locales/de-de.d.ts:4:42:
  4 │     dateLocale: import("date-fns/locale").Locale;
    ╵                                           ~~~~~~

[ERROR] TS2694: Namespace '"date-fns/locale"' has no exported member 'Locale'. [plugin angular-compiler]

node_modules/@worktile/gantt/i18n/locales/ru-ru.d.ts:4:42:
  4 │     dateLocale: import("date-fns/locale").Locale;
    ╵                                           ~~~~~~

[ERROR] TS2305: Module '"date-fns"' has no exported member 'FirstWeekContainsDate'. [plugin angular-compiler]

node_modules/@worktile/gantt/utils/date.d.ts:1:17:
  1 │ import { Locale, FirstWeekContainsDate } from 'date-fns';

Steps to Reproduce:

  1. Install the @worktile/gantt library in an Angular project.

  2. Build the project or run ng serve.

  3. The errors will appear in the console.

Expected Behavior: The @worktile/gantt library should install and run without any compilation issues.

Actual Behavior: Compilation fails due to missing exports (Locale and FirstWeekContainsDate) from date-fns.

Possible Solution: The issue may be related to an incompatible version of date-fns. I recommend checking the version compatibility between @worktile/gantt and date-fns. Alternatively, it may be useful to update the @worktile/gantt library to support newer versions of date-fns.

Environment:

Angular version: 17.3.12

@worktile/gantt version: 18.1.0-next.2

date-fns version: 4.1.0

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