Replace svg-loader with babel-plugin-inline-react-svg
I want to do some optimizations on how react-dates is built, to help reduce the bundle size impact of using this project. The first step I see is reducing the size of each of the components, which we can achieve by avoiding building them with webpack. From what I can tell, webpack was only brought in to support getting SVGs in these components. We can pretty easily replace this with a Babel transform that will achieve the same result, but with less complexity in our build, and a little less overhead in the resulting components. Before this change: ``` ~/react-dates ❯❯❯ du -hs lib/components 420K lib/components ``` After this change: ``` ~/react-dates ❯❯❯ du -hs lib/components 348K lib/components ```
Showing
- .babelrc 1 addition, 0 deletions.babelrc
- karma.conf.js 0 additions, 20 deletionskarma.conf.js
- package.json 4 additions, 5 deletionspackage.json
- src/components/CalendarIcon.jsx 4 additions, 0 deletionssrc/components/CalendarIcon.jsx
- src/components/ChevronDown.jsx 4 additions, 0 deletionssrc/components/ChevronDown.jsx
- src/components/ChevronUp.jsx 4 additions, 0 deletionssrc/components/ChevronUp.jsx
- src/components/CloseButton.jsx 4 additions, 0 deletionssrc/components/CloseButton.jsx
- src/components/DateRangePicker.jsx 1 addition, 1 deletionsrc/components/DateRangePicker.jsx
- src/components/DateRangePickerInput.jsx 4 additions, 4 deletionssrc/components/DateRangePickerInput.jsx
- src/components/DayPickerKeyboardShortcuts.jsx 1 addition, 1 deletionsrc/components/DayPickerKeyboardShortcuts.jsx
- src/components/DayPickerNavigation.jsx 4 additions, 4 deletionssrc/components/DayPickerNavigation.jsx
- src/components/LeftArrow.jsx 4 additions, 0 deletionssrc/components/LeftArrow.jsx
- src/components/RightArrow.jsx 4 additions, 0 deletionssrc/components/RightArrow.jsx
- src/components/SingleDatePicker.jsx 1 addition, 1 deletionsrc/components/SingleDatePicker.jsx
- src/components/SingleDatePickerInput.jsx 2 additions, 2 deletionssrc/components/SingleDatePickerInput.jsx
- test/components/DayPickerKeyboardShortcuts_spec.jsx 1 addition, 1 deletiontest/components/DayPickerKeyboardShortcuts_spec.jsx
- test/components/SingleDatePicker_spec.jsx 1 addition, 1 deletiontest/components/SingleDatePicker_spec.jsx
- webpack.config.js 0 additions, 76 deletionswebpack.config.js
Loading
Please register or sign in to comment