question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi @bvaughn ,

We are glad that this library is performing so well on mobile devices for us. One thing that we are concerned about is the bundle size. We are using webpack 2 for bundling with tree-shaking. Currently react-virtualized’s size in our bundle can be seen below.

screen shot 2016-10-07 at 7 38 21 pm

This is when we are using InfiniteScroller with List. Even though I am fine with this, I would like to know whether this can be improved ? Because even slight reductions in file size can do wonders on mobile.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:37 (11 by maintainers)

github_iconTop GitHub Comments

12reactions
SpencerCarstenscommented, Nov 23, 2016

Ran into the same exact issue. Webpack 2 and tree-shaking did not work until:

// Changing...
import { AutoSizer, Column, Table, InfiniteLoader } from 'react-virtualized';

// To...
import { InfiniteLoader } from 'react-virtualized/dist/es/InfiniteLoader';
import { AutoSizer } from 'react-virtualized/dist/es/AutoSizer';
import { Column, Table } from 'react-virtualized/dist/es/Table';

👍

6reactions
ritz078commented, Oct 8, 2016

Here are all the cases that I tried

Case I

import {InfiniteLoader, AutoSizer, List} from 'react-virtualized'

Build: ✅ Loading form : es File size: increases Tree shaking: ❌

Case II

import { InfiniteLoader } from 'react-virtualized/InfiniteLoader'
import { AutoSizer } from 'react-virtualized/AutoSizer'
import { List } from 'react-virtualized/List'

Build: ❌ can’t resolve modules

Case III

import { InfiniteLoader } from 'react-virtualized/dist/es/InfiniteLoader'
import { AutoSizer } from 'react-virtualized/dist/es/AutoSizer'
import { List } from 'react-virtualized/dist/es/List'

Build: ✅ File size: decreases But when I make a request, it gives an error "Unhandled Promise rejection: SyntaxError: Unexpected token import". This has nothing to do with react-virtualized. We even tried this with react-router and got the same error. So either webpack issue or our config. Its really tough with the lack of docs on webpack 2 currently.

Case IV

import { InfiniteLoader } from 'react-virtualized/dist/commonjs/InfiniteLoader'
import { AutoSizer } from 'react-virtualized/dist/commonjs/AutoSizer'
import { List } from 'react-virtualized/dist/commonjs/List'

Build: ✅ File size : decreases Everything works fine.

So currently we are using this. Hopefully we will be able to figure out the webpack issue soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bundlephobia | Size of npm dependencies
Bundlephobia helps you find the performance impact of npm packages. Find the size of any javascript package and its effect on your frontend...
Read more >
Slimming down your bundle size - LogRocket Blog
A critical part for improving frontend performance is to reduce the JavaScript bundle size that should be downloaded via the network.
Read more >
bundlejs - Online bundler + npm package bundle size checker
A quick and easy way to bundle, minify, and compress (gzip and brotli) your ts, js, jsx and npm projects all online, with...
Read more >
5 Methods to Reduce JavaScript Bundle Size - Bits and Pieces
4. Compressing Bundles. If your application bundle size increases and affects performance, you can compress them to reduce the size. Gzip and ...
Read more >
Analyze your React app's bundle size and reduce it using ...
As your React app gets larger, you may have to start worrying about its bundle size. An app's bundle size is the amount...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found