Skip to content

Display warning on reexporting in shared public API large size module that affects bundle size #137

Description

@ratomiru

Problem

According to "Large bundles and broken tree-shaking in Shared", there may be some cases where one shared module size is extremely large. In these cases using something like button on page 1 can lead to downloading whole big heavy package like drag'n'drop library which is intended for page 2

Solution

It would be nice to check total external packages size a reexported file uses. I am not sure, is it possible technically, so I just share the idea

Some points

Example

/shared/ui
    button.tsx // chakra-ui: 54k, total: 54k
    date-picker.tsx // chakra-ui: 54k, dayjs: 8k, total: 62k
    code-editor // @codeium/react-code-editor: 4mb, total: 4mb

shared/ui/index.ts

export { Button } from './button'
export { DatePicker } from './date-picker'
export { CodeEditor } from './code-editor' // 4mb is quite heavy so linter will show warning

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions