Skip to content

[Discussion] Reducing Bundle Size #260

Open
@brendanmoore

Description

@brendanmoore

Currently the target package is umd when built with webpack this means that when we subsequently use this library it is non-trivial for our bundlers to optimise or tree-shake away any unused parts of the library. There are some quick wins such as making third-party imports more specific. e.g.

// Changing this...
import { AutoSizer, List } from 'react-virtualized';  
// To this...
import { AutoSizer } from 'react-virtualized/dist/es/AutoSizer';
import { List } from 'react-virtualized/dist/es/List';  

In this example this would help bundlers (like webpack) tree-shake the react-virtualized library and keep the our app bundle sizes smaller.

Another really awesome thing to do and potentially more benificial would be to look adding esm (es modules) as another build target and have side-effects: false in the package.json. With this in place we could look at potentially hoisting out the optional internals such as NodeRendererDefault, PlaceholderRendererDefault and SortableTreeWithoutDndContext

Initially it could all be done in way that presents no breaking changes. What do you think?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions