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

Vanilla Extract performance w/ @mantine/vanilla-extract #5184

Open
wenchonglee opened this issue Nov 3, 2023 · 4 comments
Open

Vanilla Extract performance w/ @mantine/vanilla-extract #5184

wenchonglee opened this issue Nov 3, 2023 · 4 comments
Labels
help wanted Contributions from community are welcome

Comments

@wenchonglee
Copy link

What package has an issue

@mantine/vanilla-extract

Describe the bug

Hi,

I've been planning the migration to v7 for a while and have been torn between CSS Modules and Vanilla Extract.
The biggest concern I had was performance during development (a built app is fine), so I did a bit of experimenting.

This is a repo I quickly wrote to test things out:

TL;DR
There are 3 "Kitchen sink" components, each with a list of 100 components.
This isn't very scientific, all I did was start the dev server and wait for network calls to end in the browser, then record the final timing.

  • CSS Modules (500ms)
  • Vanilla Extract using the theme from createGlobalTheme (1.5s)
  • Vanilla Extract using the theme from @mantine/vanilla-extract (30s)

I tried to dig a little bit but I'm not familiar enough with how Vite plugins work to really understand the issue. I'm raising the issue here since it seems importing static values is completely fine.

I'm willing to help investigate but I'll need help understanding the issue.

Thanks in advance!

What version of @mantine/* packages do you have in package.json? (Note that all @mantine/* packages must have the same version in order to work correctly)

7.1.5

If possible, please include a link to a codesandbox with the reproduced problem

https://stackblitz.com/~/github.com/wenchonglee/ve-mantine-benchmark

Do you know how to fix the issue

No

Are you willing to participate in fixing this issue and create a pull request with the fix

Yes

Possible fix

No response

@rtivital
Copy link
Member

rtivital commented Nov 3, 2023

Hi @wenchonglee, thanks for researching the issue and providing a reproduction. You are welcome to research the issue further and propose a fix. I do not have much experience with Vanilla Extract plugins, so I won't probably be able to help wih this.

@rtivital rtivital added the help wanted Contributions from community are welcome label Nov 7, 2023
@wenchonglee
Copy link
Author

The underlying issue has been identified in this comment vanilla-extract-css/vanilla-extract#1211 (comment).

I'm not sure if you want to consider his suggestions to mantine, but I will probably try modifying esbuildOptions.externals of @vanilla-extract/vite-plugin for a start. Please feel free to close the issue if you also want to leave it at that!

@robmonie
Copy link

I'm not sure this is the same issue but we have a Remix app using Mantine and Vanilla Extract. The initial build has always been much slower than another much larger remix app we have that uses chakra (45s vs 3s).

When we tried to upgrade to Mantine 7.3.0, we found that the build would just hang and never complete so we're pretty keen to get to the bottom of this.

@askoufis
Copy link

askoufis commented Apr 2, 2024

This seems to be less of an issue since we released the new VE vite plugin. Just quickly ran your reproduction with the latest vite and @vanilla-extract/vite-plugin versions (also removed the pinned @vanilla-extract/integration dependency) and the load page load time on my M1 pro was significantly faster, relative to the reproduction (without the plugin patch).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Contributions from community are welcome
Projects
None yet
Development

No branches or pull requests

4 participants