Skip to content

Can't bundle - date-fns #1374

Description

@poof86

Unbundled module

When imported via an importmap like so

<script type="importmap">
{
  "imports": {
    "@daypicker/react": "https://esm.sh/@daypicker/react?external=date-fns,date-fns/locale",
    "date-fns": "https://esm.sh/date-fns",
    "date-fns/locale": "https://esm.sh/date-fns/locale"
  }
}
</script>

Instead of bundling

  • date-fns makes 250 separate requests for module imports
  • date-fns/locale makes 100 separate requests for module imports

This causes esm.sh to throttle my requests sometimes, it seems

If I only use @daypicker/react I get the same amount of network requests
If I add ?standalone to date-fns and date-fns/locale nothing changes

@daypicker imports date-fns like so:

import {addDays as So, addMonths as Eo, addWeeks as Io, addYears as Yo, differenceInCalendarDays as Bo, differenceInCalendarMonths as Fo, eachMonthOfInterval as _o, eachYearOfInterval as To, endOfISOWeek as Po, endOfMonth as Ao, endOfWeek as Ro, endOfYear as Ho, format as Go, getISOWeek as qo, getMonth as Ko, getWeek as jo, getYear as $o, isAfter as zo, isBefore as Vo, isDate as Zo, isSameDay as Lo, isSameMonth as Jo, isSameYear as Qo, max as Xo, min as Uo, setMonth as er, setYear as tr, startOfDay as or, startOfISOWeek as rr, startOfMonth as nr, startOfWeek as sr, startOfYear as ar} from "date-fns";

Additional info

  • Browser info: Chrome on MacOS

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

    browserNot working in Browser

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions