-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Splitting sandpack from main bundle #4256
Splitting sandpack from main bundle #4256
Conversation
Size Changes📦 Next.js Bundle AnalysisThis analysis was generated by the next.js bundle analysis action 🤖 🎉 Global Bundle Size Decreased
DetailsThe 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 If you want further insight into what is behind the changes, give @next/bundle-analyzer a try! One Hundred Eighty-three Pages Changed SizeThe following pages changed size from the code in this PR compared to its base branch:
DetailsOnly 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 Any third party scripts you have added directly to your app using the 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. |
Sandpack (without highlighting and output) renders, Then the fallback and then the complete sandpack... VideoScreen.Recording.2022-01-30.at.1.05.11.PM.mov |
40d62bb
to
7c8484c
Compare
Prerequisite fixes for this to work: |
52c53b1
to
26310fe
Compare
187f8fa
to
3b593f8
Compare
3b593f8
to
b06a343
Compare
dbf52db
to
be3bb2f
Compare
|
|
@danilowoz during the initial render the sandpack content is loaded but without the code formatting (it is loaded as string). Later we get the fallback and then the formatted code. Need help in finding why code is rendered as string during initial render. PS: Build fails you can try the same change in local |
@harish-sethuraman currently, it's not possible, due to some CodeMirror limitations. But Sandpack is going to support it very soon, as we made some important progress in SSR support (codesandbox/sandpack#276). If you want to give it a try, take a look at this PR https://github.com/danilowoz/reactjs.org/pull/1 - but, please don't use it for production, there are a few breaking change comming in this implementation. |
This change splits sandpack and codeblock into separate chunks. So there are lot of components to test.
|
looks great. wanna press merge? if something breaks we'll roll back |
🚀 |
Tried to split the sandpack and added a fallback with suspense
Adding suspense to
Sandpack
reduced~9.55KB
Adding a wrapper to
codeBlock
andSandpack
reduced~150KB
Fallback preview here: https://beta-reactjs-org-namamgdvj-fbopensource.vercel.app/learn