Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(boilerplate): date-fns import syntax (#2510 by @markrickert)
Because react-native doesn’t tree-shake, importing things from `date-fns` bundles ALL of the `date-fns` library, which is quite heavy. Changing from the syntax `import { Locale, format, parseISO } from "date-fns”` to importing them individually like: ```ts import type Locale from "date-fns/locale" import format from "date-fns/format" import parseISO from "date-fns/parseISO" ``` Saves us 0.41 megabytes in the production bundle size of an ignited app. That’s a HUGE savings for such a small syntax thing. I also added scripts to the boilerplate to use `react-native-bundle-visualizer` through `npx` (which is how i determined this bundle filesize savings). Before this PR: `yarn bundle:visualize`: 5.13mb After this PR: `yarn bundle:visualize`: 4.72mb
- Loading branch information