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.

Bundle size increase

See original GitHub issue

I actually do not know if it is a bug yet but want to make sure.

I upgraded today from version 8.0.1 to 10.0.0. My app bundle size instantly went from 77KB gzipped to 380KB gzipped. That happened by upgrading the packages and fixing the imports.

I also tested a bare install of react-syntaxc-highlighter with create-react-app. 8.0.1 and 9.0.1 gives small payloads while 10.0.0 instantly adds 300KB to the gzipped payload.

Is this an expected payload increase? Can I avoid it?

My imports look like this

import { LightAsync as SyntaxHighlighter } from 'react-syntax-highlighter';
import { PrismAsyncLight as SyntaxHighlighterJsx } from 'react-syntax-highlighter';
import javascript from 'react-syntax-highlighter/dist/languages/hljs/javascript';
import jsx from 'react-syntax-highlighter/dist/languages/prism/jsx';
import json from 'react-syntax-highlighter/dist/languages/hljs/json';
import { hybrid } from 'react-syntax-highlighter/dist/styles/hljs';
import { atomDark } from 'react-syntax-highlighter/dist/styles/prism';

I am also not seeing any code splitting happening with these imports even though I am using Webpack.

Finding it hard to figure out exactly what is going wrong as the documentation does not fully reflect the reality at this stage.

Any help would be appreciated.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
AlmeroSteyncommented, Nov 6, 2018

@marcodejongh I tested it in an app bootstrapped with create-react-app v2. The exact webpack version is 4.19.1.

Setting sideEffects to false indeed does take away the bloat! 301.82KB difference between a build with this in package.json versus the version as installed from npm.

0reactions
marcodejonghcommented, Nov 6, 2018

@conorhastings I’ll get on top of fixing tree shaking. We should also make a decision on what API’s we wanna support moving forward, imo we probably should only support the “dynamic importing version” and the “everything included version”. So Prism & PrismAsyncLight, Light & LightAsync

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 >
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 >
Small Bundles, Fast Pages: What To Do With Too Much ...
This post will explain why bundle size matters and recommend tools and ... cause Cumulative Layout Shifts, increase First Input Delay, ...
Read more >
3 ways to reduce webpack bundle size - Jakob Lind
Go through these three steps to get a quick overview of what to do to reduce webpack bundle size. I have listed them...
Read more >
Optimize Angular bundle size in 4 steps | by Siyang Kern Zhao
Step 1: Know your Bundle Size. It's hard to deny that initial page loading time is tightly connected with your Angular app bundle...
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