Skip to content

Avoid bundling the full lodash package for a single includes import #2788

Description

@bogdanalexe90

CalendarProvider imports includes from the lodash package root:

import { includes } from 'lodash';

When building an Expo web application with Metro, this causes the complete
lodash/lodash.js module to be included in the bundle.

Suggested change

Import the individual method instead:

-import { includes } from 'lodash';
+import includes from 'lodash/includes';

This preserves the existing behavior, including when
disableAutoDaySelection is undefined.

Measured impact

Tested with react-native-calendars@1.1314.0 and Expo SDK 56:

  • Before: the source map contained the complete lodash/lodash.js source
    (545,941 bytes).
  • After: lodash/lodash.js was absent.
  • Total lodash source represented in the source map decreased from
    approximately 754 KB to 198 KB.

The Expo web export completed successfully after applying this change.

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