Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nitpicks for code splitting #4346

Merged
merged 1 commit into from
Feb 16, 2022
Merged

Nitpicks for code splitting #4346

merged 1 commit into from
Feb 16, 2022

Conversation

gaearon
Copy link
Member

@gaearon gaearon commented Feb 16, 2022

Minor follow-ups for #4256.

import dynamic from 'next/dynamic';
import {createFileMap} from './utils';

const SandpackRoot = dynamic(() => import('./SandpackRoot'), {suspense: true});
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I switched this to dynamic because iirc this is currently optimized in Next.js (it starts prefetching them early).

@github-actions
Copy link

Size Changes

📦 Next.js Bundle Analysis

This analysis was generated by the next.js bundle analysis action 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 93.04 KB (🟡 +192 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

One Hundred Eighty-three Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/ 60.73 KB (🟡 +1.56 KB) 153.77 KB
/404 59.84 KB (🟡 +1.56 KB) 152.88 KB
/apis 60.39 KB (🟡 +1.56 KB) 153.43 KB
/apis/reactdom 60.54 KB (🟡 +1.56 KB) 153.58 KB
/apis/render 62.6 KB (🟡 +1.56 KB) 155.64 KB
/apis/usestate 71.55 KB (🟡 +1.56 KB) 164.59 KB
/blog/2013/06/02/jsfiddle-integration 71.11 KB (🟡 +1.56 KB) 164.15 KB
/blog/2013/06/05/why-react 72.83 KB (🟡 +1.56 KB) 165.88 KB
/blog/2013/06/12/community-roundup 72.54 KB (🟡 +1.56 KB) 165.58 KB
/blog/2013/06/19/community-roundup-2 73.21 KB (🟡 +1.56 KB) 166.25 KB
/blog/2013/06/21/react-v0-3-3 71.25 KB (🟡 +1.56 KB) 164.3 KB
/blog/2013/06/27/community-roundup-3 73.57 KB (🟡 +1.56 KB) 166.62 KB
/blog/2013/07/02/react-v0-4-autobind-by-default 71.87 KB (🟡 +1.56 KB) 164.92 KB
/blog/2013/07/03/community-roundup-4 72.94 KB (🟡 +1.56 KB) 165.99 KB
/blog/2013/07/11/react-v0-4-prop-validation-and-default-values 71.74 KB (🟡 +1.56 KB) 164.79 KB
/blog/2013/07/17/react-v0-4-0 72.45 KB (🟡 +1.56 KB) 165.5 KB
/blog/2013/07/23/community-roundup-5 73.33 KB (🟡 +1.56 KB) 166.38 KB
/blog/2013/07/26/react-v0-4-1 71.22 KB (🟡 +1.56 KB) 164.26 KB
/blog/2013/07/30/use-react-and-jsx-in-ruby-on-rails 71.82 KB (🟡 +1.56 KB) 164.86 KB
/blog/2013/08/05/community-roundup-6 72.63 KB (🟡 +1.56 KB) 165.67 KB
/blog/2013/08/19/use-react-and-jsx-in-python-applications 71.83 KB (🟡 +1.56 KB) 164.88 KB
/blog/2013/08/26/community-roundup-7 72.8 KB (🟡 +1.56 KB) 165.84 KB
/blog/2013/09/24/community-roundup-8 74.23 KB (🟡 +1.56 KB) 167.28 KB
/blog/2013/10/03/community-roundup-9 73.16 KB (🟡 +1.56 KB) 166.21 KB
/blog/2013/10/16/react-v0.5.0 72.85 KB (🟡 +1.56 KB) 165.89 KB
/blog/2013/10/29/react-v0-5-1 71.21 KB (🟡 +1.56 KB) 164.25 KB
/blog/2013/11/06/community-roundup-10 74.83 KB (🟡 +1.56 KB) 167.87 KB
/blog/2013/11/18/community-roundup-11 73.9 KB (🟡 +1.56 KB) 166.95 KB
/blog/2013/12/18/react-v0.5.2-v0.4.2 71.68 KB (🟡 +1.56 KB) 164.72 KB
/blog/2013/12/19/react-v0.8.0 72.1 KB (🟡 +1.56 KB) 165.14 KB
/blog/2013/12/23/community-roundup-12 73.56 KB (🟡 +1.56 KB) 166.6 KB
/blog/2013/12/30/community-roundup-13 73.34 KB (🟡 +1.56 KB) 166.39 KB
/blog/2014/01/02/react-chrome-developer-tools 71.6 KB (🟡 +1.56 KB) 164.64 KB
/blog/2014/01/06/community-roundup-14 72.94 KB (🟡 +1.56 KB) 165.98 KB
/blog/2014/02/05/community-roundup-15 74.15 KB (🟡 +1.56 KB) 167.2 KB
/blog/2014/02/15/community-roundup-16 73.86 KB (🟡 +1.56 KB) 166.91 KB
/blog/2014/02/16/react-v0.9-rc1 74.27 KB (🟡 +1.56 KB) 167.31 KB
/blog/2014/02/20/react-v0.9 74.71 KB (🟡 +1.56 KB) 167.76 KB
/blog/2014/02/24/community-roundup-17 73.58 KB (🟡 +1.56 KB) 166.62 KB
/blog/2014/03/14/community-roundup-18 74.55 KB (🟡 +1.56 KB) 167.59 KB
/blog/2014/03/19/react-v0.10-rc1 72.85 KB (🟡 +1.56 KB) 165.9 KB
/blog/2014/03/21/react-v0.10 72.88 KB (🟡 +1.56 KB) 165.92 KB
/blog/2014/03/28/the-road-to-1.0 72.99 KB (🟡 +1.56 KB) 166.03 KB
/blog/2014/04/04/reactnet 71.63 KB (🟡 +1.56 KB) 164.67 KB
/blog/2014/05/06/flux 71.76 KB (🟡 +1.56 KB) 164.8 KB
/blog/2014/05/29/one-year-of-open-source-react 71.98 KB (🟡 +1.56 KB) 165.03 KB
/blog/2014/06/27/community-roundup-19 73.52 KB (🟡 +1.56 KB) 166.57 KB
/blog/2014/07/13/react-v0.11-rc1 73.91 KB (🟡 +1.56 KB) 166.95 KB
/blog/2014/07/17/react-v0.11 75.17 KB (🟡 +1.56 KB) 168.21 KB
/blog/2014/07/25/react-v0.11.1 72.11 KB (🟡 +1.56 KB) 165.16 KB
/blog/2014/07/28/community-roundup-20 73.67 KB (🟡 +1.56 KB) 166.71 KB
/blog/2014/07/30/flux-actions-and-the-dispatcher 73.3 KB (🟡 +1.56 KB) 166.34 KB
/blog/2014/08/03/community-roundup-21 73.33 KB (🟡 +1.56 KB) 166.38 KB
/blog/2014/09/03/introducing-the-jsx-specification 71.34 KB (🟡 +1.56 KB) 164.38 KB
/blog/2014/09/12/community-round-up-22 73.82 KB (🟡 +1.56 KB) 166.86 KB
/blog/2014/09/16/react-v0.11.2 72.11 KB (🟡 +1.56 KB) 165.16 KB
/blog/2014/09/24/testing-flux-applications 75.29 KB (🟡 +1.56 KB) 168.33 KB
/blog/2014/10/14/introducing-react-elements 74.25 KB (🟡 +1.56 KB) 167.29 KB
/blog/2014/10/16/react-v0.12-rc1 74.21 KB (🟡 +1.56 KB) 167.26 KB
/blog/2014/10/17/community-roundup-23 74.78 KB (🟡 +1.56 KB) 167.83 KB
/blog/2014/10/27/react-js-conf 71.39 KB (🟡 +1.56 KB) 164.43 KB
/blog/2014/10/28/react-v0.12 74.15 KB (🟡 +1.56 KB) 167.2 KB
/blog/2014/11/24/react-js-conf-updates 71.77 KB (🟡 +1.56 KB) 164.82 KB
/blog/2014/11/25/community-roundup-24 75.01 KB (🟡 +1.56 KB) 168.06 KB
/blog/2014/12/18/react-v0.12.2 71.8 KB (🟡 +1.56 KB) 164.84 KB
/blog/2014/12/19/react-js-conf-diversity-scholarship 72.19 KB (🟡 +1.56 KB) 165.24 KB
/blog/2015/01/27/react-v0.13.0-beta-1 73.16 KB (🟡 +1.56 KB) 166.21 KB
/blog/2015/02/18/react-conf-roundup-2015 75.15 KB (🟡 +1.56 KB) 168.19 KB
/blog/2015/02/20/introducing-relay-and-graphql 74.3 KB (🟡 +1.56 KB) 167.34 KB
/blog/2015/02/24/react-v0.13-rc1 73.2 KB (🟡 +1.56 KB) 166.25 KB
/blog/2015/02/24/streamlining-react-elements 75.75 KB (🟡 +1.56 KB) 168.8 KB
/blog/2015/03/03/react-v0.13-rc2 72.54 KB (🟡 +1.56 KB) 165.58 KB
/blog/2015/03/04/community-roundup-25 73.5 KB (🟡 +1.56 KB) 166.54 KB
/blog/2015/03/10/react-v0.13 73.81 KB (🟡 +1.56 KB) 166.86 KB
/blog/2015/03/16/react-v0.13.1 71.63 KB (🟡 +1.56 KB) 164.68 KB
/blog/2015/03/19/building-the-facebook-news-feed-with-relay 74.39 KB (🟡 +1.56 KB) 167.43 KB
/blog/2015/03/26/introducing-react-native 71.53 KB (🟡 +1.56 KB) 164.58 KB
/blog/2015/03/30/community-roundup-26 73.46 KB (🟡 +1.56 KB) 166.51 KB
/blog/2015/04/17/react-native-v0.4 72.38 KB (🟡 +1.56 KB) 165.42 KB
/blog/2015/04/18/react-v0.13.2 71.71 KB (🟡 +1.56 KB) 164.75 KB
/blog/2015/05/01/graphql-introduction 76.2 KB (🟡 +1.56 KB) 169.25 KB
/blog/2015/05/08/react-v0.13.3 71.6 KB (🟡 +1.56 KB) 164.65 KB
/blog/2015/05/22/react-native-release-process 71.75 KB (🟡 +1.56 KB) 164.8 KB
/blog/2015/06/12/deprecating-jstransform-and-react-tools 72.21 KB (🟡 +1.56 KB) 165.25 KB
/blog/2015/07/03/react-v0.14-beta-1 73.72 KB (🟡 +1.56 KB) 166.76 KB
/blog/2015/08/03/new-react-devtools-beta 72.32 KB (🟡 +1.56 KB) 165.36 KB
/blog/2015/08/11/relay-technical-preview 72.38 KB (🟡 +1.56 KB) 165.42 KB
/blog/2015/08/13/reacteurope-roundup 73.97 KB (🟡 +1.56 KB) 167.01 KB
/blog/2015/09/02/new-react-developer-tools 71.73 KB (🟡 +1.56 KB) 164.78 KB
/blog/2015/09/10/react-v0.14-rc1 77.42 KB (🟡 +1.56 KB) 170.46 KB
/blog/2015/09/14/community-roundup-27 73.9 KB (🟡 +1.56 KB) 166.94 KB
/blog/2015/10/01/react-render-and-top-level-api 72.86 KB (🟡 +1.56 KB) 165.91 KB
/blog/2015/10/07/react-v0.14 77.9 KB (🟡 +1.56 KB) 170.95 KB
/blog/2015/10/19/reactiflux-is-moving-to-discord 73.61 KB (🟡 +1.56 KB) 166.66 KB
/blog/2015/10/28/react-v0.14.1 71.63 KB (🟡 +1.56 KB) 164.67 KB
/blog/2015/11/02/react-v0.14.2 71.65 KB (🟡 +1.56 KB) 164.7 KB
/blog/2015/11/18/react-v0.14.3 71.78 KB (🟡 +1.56 KB) 164.82 KB
/blog/2015/12/04/react-js-conf-2016-diversity-scholarship 72.65 KB (🟡 +1.56 KB) 165.7 KB
/blog/2015/12/16/ismounted-antipattern 72.25 KB (🟡 +1.56 KB) 165.3 KB
/blog/2015/12/18/react-components-elements-and-instances 76.17 KB (🟡 +1.56 KB) 169.22 KB
/blog/2015/12/29/react-v0.14.4 71.45 KB (🟡 +1.56 KB) 164.49 KB
/blog/2016/01/08/A-implies-B-does-not-imply-B-implies-A 72.46 KB (🟡 +1.56 KB) 165.51 KB
/blog/2016/01/12/discontinuing-ie8-support 71.27 KB (🟡 +1.56 KB) 164.32 KB
/blog/2016/02/19/new-versioning-scheme 72.65 KB (🟡 +1.56 KB) 165.7 KB
/blog/2016/03/07/react-v15-rc1 75.4 KB (🟡 +1.56 KB) 168.45 KB
/blog/2016/03/16/react-v15-rc2 72.27 KB (🟡 +1.56 KB) 165.31 KB
/blog/2016/03/29/react-v0.14.8 71.4 KB (🟡 +1.56 KB) 164.45 KB
/blog/2016/04/07/react-v15 79.59 KB (🟡 +1.56 KB) 172.64 KB
/blog/2016/04/08/react-v15.0.1 72.16 KB (🟡 +1.56 KB) 165.2 KB
/blog/2016/07/11/introducing-reacts-error-code-system 71.87 KB (🟡 +1.56 KB) 164.92 KB
/blog/2016/07/13/mixins-considered-harmful 80.02 KB (🟡 +1.56 KB) 173.07 KB
/blog/2016/07/22/create-apps-with-no-configuration 75.35 KB (🟡 +1.56 KB) 168.4 KB
/blog/2016/08/05/relay-state-of-the-state 75.39 KB (🟡 +1.56 KB) 168.44 KB
/blog/2016/09/28/our-first-50000-stars 76.84 KB (🟡 +1.56 KB) 169.88 KB
/blog/2016/11/16/react-v15.4.0 74.79 KB (🟡 +1.56 KB) 167.84 KB
/blog/2017/04/07/react-v15.5.0 75.35 KB (🟡 +1.56 KB) 168.4 KB
/blog/2017/05/18/whats-new-in-create-react-app 74.75 KB (🟡 +1.56 KB) 167.8 KB
/blog/2017/06/13/react-v15.6.0 73.38 KB (🟡 +1.56 KB) 166.42 KB
/blog/2017/07/26/error-handling-in-react-16 73.72 KB (🟡 +1.56 KB) 166.77 KB
/blog/2017/09/08/dom-attributes-in-react-16 74.15 KB (🟡 +1.56 KB) 167.2 KB
/blog/2017/09/25/react-v15.6.2 72.49 KB (🟡 +1.56 KB) 165.53 KB
/blog/2017/09/26/react-v16.0 77.62 KB (🟡 +1.56 KB) 170.66 KB
/blog/2017/11/28/react-v16.2.0-fragment-support 75.55 KB (🟡 +1.56 KB) 168.6 KB
/blog/2017/12/07/introducing-the-react-rfc-process 72.07 KB (🟡 +1.56 KB) 165.11 KB
/blog/2017/12/15/improving-the-repository-infrastructure 87.86 KB (🟡 +1.56 KB) 180.91 KB
/blog/2018/03/01/sneak-peek-beyond-react-16 72.03 KB (🟡 +1.56 KB) 165.07 KB
/blog/2018/03/27/update-on-async-rendering 77.27 KB (🟡 +1.56 KB) 170.31 KB
/blog/2018/03/29/react-v-16-3 74.09 KB (🟡 +1.56 KB) 167.13 KB
/blog/2018/05/23/react-v-16-4 74.23 KB (🟡 +1.56 KB) 167.27 KB
/blog/2018/06/07/you-probably-dont-need-derived-state 77.89 KB (🟡 +1.56 KB) 170.93 KB
/blog/2018/08/01/react-v-16-4-2 72.88 KB (🟡 +1.56 KB) 165.92 KB
/blog/2018/09/10/introducing-the-react-profiler 74.49 KB (🟡 +1.56 KB) 167.53 KB
/blog/2018/10/01/create-react-app-v2 74.97 KB (🟡 +1.56 KB) 168.01 KB
/blog/2018/10/23/react-v-16-6 74.17 KB (🟡 +1.56 KB) 167.21 KB
/blog/2018/11/13/react-conf-recap 71.88 KB (🟡 +1.56 KB) 164.92 KB
/blog/2018/11/27/react-16-roadmap 78.07 KB (🟡 +1.56 KB) 171.12 KB
/blog/2018/12/19/react-v-16-7 73 KB (🟡 +1.56 KB) 166.05 KB
/blog/2019/02/06/react-v16.8.0 75.27 KB (🟡 +1.56 KB) 168.31 KB
/blog/2019/02/23/is-react-translated-yet 74.83 KB (🟡 +1.56 KB) 167.88 KB
/blog/2019/08/08/react-v16.9.0 77.77 KB (🟡 +1.56 KB) 170.81 KB
/blog/2019/08/15/new-react-devtools 72.37 KB (🟡 +1.56 KB) 165.42 KB
/blog/2019/10/22/react-release-channels 74.18 KB (🟡 +1.56 KB) 167.22 KB
/blog/2019/11/06/building-great-user-experiences-with-concurrent-mode-and-suspense 78.88 KB (🟡 +1.56 KB) 171.93 KB
/blog/2020/02/26/react-v16.13.0 75.11 KB (🟡 +1.56 KB) 168.16 KB
/blog/2020/08/10/react-v17-rc 81.39 KB (🟡 +1.56 KB) 174.44 KB
/community 60.42 KB (🟡 +1.56 KB) 153.47 KB
/community/acknowledgements 61.61 KB (🟡 +1.56 KB) 154.66 KB
/community/meet-the-team 62.13 KB (🟡 +1.56 KB) 155.18 KB
/learn 64.92 KB (🟡 +1.56 KB) 157.96 KB
/learn/add-react-to-a-website 65.25 KB (🟡 +1.56 KB) 158.29 KB
/learn/adding-interactivity 67.05 KB (🟡 +1.56 KB) 160.1 KB
/learn/choosing-the-state-structure 72.79 KB (🟡 +1.56 KB) 165.83 KB
/learn/conditional-rendering 65.02 KB (🟡 +1.56 KB) 158.07 KB
/learn/describing-the-ui 64.24 KB (🟡 +1.56 KB) 157.29 KB
/learn/editor-setup 61.51 KB (🟡 +1.56 KB) 154.56 KB
/learn/escape-hatches 59.75 KB (🟡 +1.56 KB) 152.8 KB
/learn/extracting-state-logic-into-a-reducer 70.42 KB (🟡 +1.56 KB) 163.47 KB
/learn/importing-and-exporting-components 63.42 KB (🟡 +1.56 KB) 156.47 KB
/learn/installation 61.08 KB (🟡 +1.56 KB) 154.13 KB
/learn/javascript-in-jsx-with-curly-braces 63.5 KB (🟡 +1.56 KB) 156.54 KB
/learn/keeping-components-pure 67.63 KB (🟡 +1.56 KB) 160.67 KB
/learn/managing-state 66.35 KB (🟡 +1.56 KB) 159.4 KB
/learn/manipulating-the-dom-with-refs 68.26 KB (🟡 +1.56 KB) 161.3 KB
/learn/passing-data-deeply-with-context 67.77 KB (🟡 +1.56 KB) 160.81 KB
/learn/passing-props-to-a-component 67.2 KB (🟡 +1.56 KB) 160.24 KB
/learn/preserving-and-resetting-state 70.01 KB (🟡 +1.56 KB) 163.06 KB
/learn/queueing-a-series-of-state-updates 64.99 KB (🟡 +1.56 KB) 158.04 KB
/learn/react-developer-tools 60.95 KB (🟡 +1.56 KB) 153.99 KB
/learn/reacting-to-input-with-state 69.47 KB (🟡 +1.56 KB) 162.51 KB
/learn/referencing-values-with-refs 66.52 KB (🟡 +1.56 KB) 159.56 KB
/learn/render-and-commit 63.49 KB (🟡 +1.56 KB) 156.53 KB
/learn/rendering-lists 67.55 KB (🟡 +1.56 KB) 160.59 KB
/learn/responding-to-events 66.54 KB (🟡 +1.56 KB) 159.58 KB
/learn/scaling-up-with-reducer-and-context 64.56 KB (🟡 +1.56 KB) 157.61 KB
/learn/sharing-state-between-components 65.27 KB (🟡 +1.56 KB) 158.32 KB
/learn/start-a-new-react-project 61.92 KB (🟡 +1.56 KB) 154.96 KB
/learn/state-a-components-memory 70.72 KB (🟡 +1.56 KB) 163.76 KB
/learn/state-as-a-snapshot 64.54 KB (🟡 +1.56 KB) 157.58 KB
/learn/thinking-in-react 66.36 KB (🟡 +1.56 KB) 159.4 KB
/learn/updating-arrays-in-state 68.6 KB (🟡 +1.56 KB) 161.64 KB
/learn/updating-objects-in-state 68.32 KB (🟡 +1.56 KB) 161.37 KB
/learn/writing-markup-with-jsx 63.42 KB (🟡 +1.56 KB) 156.47 KB
/learn/your-first-component 64.33 KB (🟡 +1.56 KB) 157.37 KB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 10% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

@gaearon gaearon merged commit a2138f2 into main Feb 16, 2022
@rickhanlonii rickhanlonii deleted the nits branch April 29, 2024 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants