Bundle size increase
See original GitHub issueI 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:
- Created 5 years ago
- Comments:5
@marcodejongh I tested it in an app bootstrapped with
create-react-app
v2. The exact webpack version is4.19.1
.Setting
sideEffects
to false indeed does take away the bloat!301.82KB
difference between a build with this inpackage.json
versus the version as installed fromnpm
.@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