-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Web build performance: Tracking issue #21853
Comments
Heads up @AlicjaSuska @umpox @valerybugakov @5h1rU @pdubroy - the "team/frontend-platform" label was applied to this issue. |
Adding some general thoughts:
|
The current stateFor future reference based on the Slack discussion. Did we try/consider esbuild?Yes, @sourcegraph/frontend-platform considered Esbuild and tried using esbuild-loader in our Webpack config. Esbuild issuesEsbuild doesn't support hot-module-replacement yet. This is one of the main blockers. Esbuild performance is awesome, but it's important for DX to bypass page load time and API requests when working on the web app UI. Ryan Florence left a great comment about it. It seems that Vite got the best from both worlds but still has many small inconveniences compared to Webpack (based on the GH issues and hacker news discussions), which are the result of an immature plugins ecosystem. Another important consideration: apart from the web app, we have Storybook and browser extension powered by Webpack. We want to keep one tool for all our web applications because it results in a predictable behavior, and it's easier to support one instrument. Storybook just started working on the experimental API for custom builders like Vite but doesn't support raw Esbuild yet. Last but not least, complete migration requires quite a bit of time. We didn't have a chance to explore all the available options yet properly. Even Webpack 5 upgrade got stuck twice because of various issues. As @sourcegraph/frontend-platform, we allocated time in Q3 to dig into available build tools and investigate tradeoffs properly. Webpack improvements overviewWebpack 5 brings persistent caching, which significantly improves build performance and recompilation. With additional tweaks like DLL Plugin, it can be improved further. Also, we can consider module federation to avoid building the whole web application in development but split it up into multiple sub-applications via Webpack 5 plugins. Current directionKeeping Webpack (at least for now) seems like a more stable/simple way of improving our web build performance. We're definitely keeping an eye on Esbuild and other modern build tools available. Looking forward to exploring them properly in Q3. |
@valerybugakov Thank you! This is very helpful to understand. I personally found the slow recompilation so bad that I prefer fast esbuild to anything else, even if that means lack of HMR, consistency (w/storybook), etc. Maybe it's just worse on my machine, though? It takes ~5-10s to recompile and reload, and I'm on an AMD Epyc 64-core workstation with 128GB RAM. Also, the benefits of speeding up our frontend dev seem so large that it makes sense to prioritize them really highly above other frontend work. If you agree but weren't able to convince others of the importance of this kind of work, I'd be curious to hear that. Anyway, with all this said, I trust you to make the right call here, I just want to give my input as a drive-by dev (not as CEO). |
@sqs, definitely, we see the issue with recompilation. Webpack 5 upgrade improves JS recompilation and multiple other things. It's in the SCSS recompilation is slow too. Right now, ~70% of stylesheets are combined into one giant file, which means that changing one rule results in bundling it again from scratch. This aspect will be addressed by completely migrating to CSS modules, which will allow rebuilding SCSS files independently from each other. I agree that speeding our frontend dev tooling is important; that's why we allocated a significant time to such improvements on our roadmap and landed a couple of important ones already. After completing current goals, we will revisit modern build tools alternatives once again. |
Heads up @pdubroy - the "team/frontend-platform" label was applied to this issue. |
Description
To improve the front-end developer experience, we'd like to focus on improving build times for Storybook and the main web app bundle.
Tracked issues
@valerybugakov
#22580)#22395)Completed
Legend
The text was updated successfully, but these errors were encountered: