From 6b2d52f582c9fc12770d0f3090bd9a1e5447c72c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Gomes?= Date: Mon, 27 Apr 2020 10:40:09 +0100 Subject: [PATCH] Import from individual react-dates component This avoids the tree-shaking issues in `react-dates` that end up causing too much of the library to be imported when importing from the index. --- packages/components/src/date-time/date.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/components/src/date-time/date.js b/packages/components/src/date-time/date.js index e912a2fd8f999..c650df693c4da 100644 --- a/packages/components/src/date-time/date.js +++ b/packages/components/src/date-time/date.js @@ -2,7 +2,9 @@ * External dependencies */ import moment from 'moment'; -import { DayPickerSingleDateController } from 'react-dates'; +// react-dates doesn't tree-shake correctly, so we import from the individual +// component here, to avoid including too much of the library +import DayPickerSingleDateController from 'react-dates/lib/components/DayPickerSingleDateController'; /** * WordPress dependencies