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

[Feature]: make v9 codesandbox demos fast #29435

Closed
1 task done
Hotell opened this issue Oct 6, 2023 · 4 comments
Closed
1 task done

[Feature]: make v9 codesandbox demos fast #29435

Hotell opened this issue Oct 6, 2023 · 4 comments

Comments

@Hotell
Copy link
Contributor

Hotell commented Oct 6, 2023

Library

React Components / v9 (@fluentui/react-components)

Describe the feature that you would like added

ATM when opening docsite demos on codesandbox, loading time of codesandbox is quite long which provides subpar DX and also bad look on v9 library.

instead of instant demo this is what user sees. Try some of the Menu demos for example https://react.fluentui.dev/?path=/docs/components-menu-menu--default

image

The loadtime tends to be more than 10 seconds ( depends on how many components are involved in particular demo. in general more components = slower start )

Have you discussed this feature with our team

@microsoft/fluentui-react-build

Additional context

No response

Validations

  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Priority

Normal

@Hotell
Copy link
Contributor Author

Hotell commented Oct 6, 2023

I did some research on this and here are the results:

why is current Browser codesandbox version so slow ?

  • because CRA is using babel which is X times slower than swc/esbuild
  • because react-components exports all v9 apis from 1 barrel / which is slow to parse for old CRA webpack/babel combo ( not for swc/esbuild )

potential solutions:

  1. new codesandbox cloud boxes ( Docker containers ) looks like it could resolve all our issues

I created 2 container templates:

As we can see, loading them is almost instant. Can we use those for our demos?

NO

Why:

Every DEMO* is dynamically generated via define API.

Switching to Container boxes is possible, unfortunately it would be much slower than Browser boxes because every demo would be brand new container, which means on every demo click:

  • creating container from scratch
  • installing all dependencies from scratch ( slow yarn v1 isn't helping here as well )
  • running server ( fast )

DEMO*:

image

Summary:

To make our demos blazing fast we need to use combination of synced templates that use Codesandbox containers + ability to dynamically add files to them via define API. This functionality is currently not supported codesandbox/codesandbox-importers#151.

TODO:

@Hotell
Copy link
Contributor Author

Hotell commented Oct 10, 2023

what about Stackblitz: ?

Issues:

Web-containers are significantly faster than codesandbox containers ! Thus having "open in stackblitz" using web-container + vite under the hood provides quite good DX.

I've implemented an MVP where folks can test it out

image

Because this issue has not had activity for over 150 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Resolution: Soft Close Soft closing inactive issues over a certain period label Mar 10, 2024
@Hotell Hotell reopened this Mar 12, 2024
@Hotell
Copy link
Contributor Author

Hotell commented Mar 12, 2024

Closing as implemented by:

@Hotell Hotell closed this as completed Mar 12, 2024
@Hotell Hotell removed the Resolution: Soft Close Soft closing inactive issues over a certain period label Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant