[Dead code elimination] Improve ability of unused code to be removed by minifiers
- Dominant language
- TypeScript
- Stars
- 247
- Forks
- 78
- Avg merge
- 14h 27m
- Merged PRs (30d)
- 15
Description
## Now
Certain parts of UUI codebase cannot be removed by minifiers even if unused
## To Do
### 1. Convert class-based React components with static props to functional React components
- [ ] uui-components/src/navigation/MainMenu/Burger/Burger.tsx
- [ ] uui-components/src/navigation/MainMenu/MainMenu.tsx
- [ ] uui-components/src/overlays/Dropdown.tsx (`high priority, because it is big`)
- [ ] uui-components/src/overlays/Snackbar.tsx
- [ ] uui-components/src/widgets/Paginator.tsx
- [ ] uui-components/src/layout/flexItems/VPanel.tsx
- [x] uui-components/src/overlays/ModalBlocker.tsx
- [x] uui-components/src/overlays/Modals.tsx
- [x] uui-components/src/overlays/ModalWindow.tsx
- [ ] uui-components/src/widgets/Paginator.tsx
- [ ] uui-components/src/Text.tsx
- [ ] uui-components/src/table/DataTableHeaderCell.tsx
- [ ] uui-components/src/table/DataTableHeaderRow.tsx
- [ ] uui-core/src/services/dnd/DragGhost.tsx
- [ ] uui/components/pickers/DataPickerBody.tsx
### 2. Wrap initialization of 'heavy' constants into "TREE_SHAKEABLE_INIT"
>Notes:
1. It is only for those constants which are initialized during module load, use next example as a reference: uui/i18n.ts
>2. If such constant contains side-effect during initialization, then DO NOT wrap it into TREE_SHAKEABLE_INIT. Otherwise it might cause weird issues in the apps which use UUI library. Instead, try to get rid of side effect upon initialization if possible.
>3. The"@epam/uui-core" and "@epam/uui-components" modules must not have side effects at all, because they are marked as side effect free in their package.json files ("sideEffect": false)
- [ ] epam-promo/i18n.ts
- [ ] uui-core/src/i18n.ts
- [ ] loveship/i18n.ts
- [ ] uui-components/src/i18n.tsx
- [ ] uui-editor/src/serialization.ts
- [ ] uui-editor/src/defaultPlugins.ts
- [ ] uui-editor/src/SlateEditor.tsx
### 3. Replace CommonJs 3rd party libs by ESM version (if possible)
- [ ] dayjs (High priority, because it's big. See discussion here: https://github.com/iamkun/dayjs/issues/1765)
- [ ] react-custom-scrollbars-2
Contributor guide
Assessment
This issue has not been assessed yet.