-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Javascript heap out of memory when doing build-storybook #6408
Comments
This issue ended up being resolved when I upgraded to the latest storybook version, 5.0.6. |
Thanks for following up @yuanstanley -- glad it's working for you! |
I want to reopen this issue Describe the bug thre strange part for me is, that the build run previous without problems. But from one day to the next it does not work anymore. My collegues run on the same OS, the exact same version of storybook (same package lockfile) but do not run into the issue. Here the full error:
To Reproduce Expected behavior Screenshots Code snippets System: System: Framework: React Additional context
All of that does not solve the error. |
@ndelangen what's the current thinking on terser plugin? |
The quickfix for me was to use the node version 12.x instead of 10.x . I don't know why, but this solves the problem for me at the moment. If I switch back to 10, it is still failing 🤷♀️ |
It's the best in class javascript minifier AFAIK. @Tobi-mmt I'm not sure what to do.. Well code splitting will possibly help. |
Hmm, it's failing for me even on Node 12. Getting that same error: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory |
Could you try:
or increase the number to more? |
I did try 4096 and it still failed. I tried 8192 and it just never finished. I suppose I should try spliiting things into layers, maybe the polyfills for IE. |
I too am facing this issue. Any updates ? |
Same error here with Storybook Using
Question: I went to the Storybook docs on customizing webpack but couldn't even find the words As I really don't want to become a Webpack expert and I don't need any fancy bundling or any other optimization, I just need to get Storybook to work and be served as a static HTML site. If it's not minified, if it's not bundled but it's working that would be cool and perhaps all I'll ever need. Please let me know what should I change to serve Storybook the simplest possible way and no longer be stuck at the Thanks in advance for any advice! |
For me this worked : NODE_OPTIONS=--max_old_space_size=4096 build-storybook . |
Storybook as a component gallery is an amazing project and then we're here: developers struggling to take the most of this beautiful tool due to bundling size optimization issues - bundling that is not even needed in many scenarios. Why is bundling such an important thing for a project like Storybook that mainly targets internal audience? It's very likely only devs, product owners, managers, designers, UX/UI teams will need to interact with a Storybook instance. How big can an internal team like that be? 500 (five hundred) people in a really big enterprise? In a scenario with up to 500 Storybook users is all this out-of-the-box optimization really worth it? Sorry, I'm completely new to this project and don't mean to be critical, just putting this as food for thought. |
@jfoliveira would you be interested in voicing your opinion on this matter in our next roadmap meeting?: |
Hey @ndelangen ! Thanks for the invite! Not sure if l'll be able to make it to the roadmap meeting but I'll try to attend. In the meantime, for those still facing this same issue when building Storybook, I share below the minimal config changes that I came up with on my module.exports = {
webpackFinal: async (config, { configType }) => {
config.optimization = {
minimize: false,
minimizer: [],
};
return config;
},
stories: ['../**/*.stories.js'],
addons: [
... After applying these changes the error message Some numbers that might be helpful:
Hope this helps other Storybook users on deciding whether disabling bundling might be an option for them or not. |
Maybe to add a little more information. I have the same memory leak issue when running Storybook Version: 5.3.18
|
storybook/react:: v5.3.18 |
We've got two (large ish) projects that build storybooks as part of their CI, both started failing with storybook/react:: v5.3.19 |
Same 7.0.8 |
Does someone have a repro I could use for an experiment? I wonder if replacing Terser with esbuild would fix this problem. |
same result in 7.0.22. Tried running with 4GB but no luck |
same result in 7.0.22. Tried running with 4GB on aws amplify but no luck |
Would you mind giving this a try:? storybook/docs/snippets/common/main-config-framework-options-builder-use-swc.js.mdx Lines 1 to 16 in 3bc12db
|
@ndelangen give it a go but still got the out-of-memory problem. |
Tried this solution but still facing the same issue |
Thanks @ndelangen, looks like this fixed the memory leak issue for the vite builder with the mentioned above memory boost storybook 7.0.25 |
👋 I can reproduce with our repo using storybook In my end, removing the feature
I've tried to tweak My best guess is that |
@juanigalan91 maybe this is something you might want to try: storybook/docs/snippets/common/main-config-framework-options-builder-use-swc.js.mdx Lines 1 to 16 in 868120a
It's an experimental option to switch from |
hi @ndelangen thanks for the tip! Unfortunately I am still running out of memory. I've also tried using The only workaround that I've managed to find while keeping |
FYI |
Hope this gets fixed or at least we have a workaround for it by then. I feel like the code splitting might be a bit too agressive with Maybe we would need to split our monorepo's storybook into sub storybooks and unify all of them with storybook composition, but it feels like a regression. |
In my case, I had a few big files.
Locally, it worked for me, so the failure only happened on GitHub actions nodes. To replicate the issue, I modified the command as follows:
The fix for me was to reduce a JSON file used for providing demo data for one of the stories and then the files got smaller.
In any case, @ndelangen , here's our repository if you want a reproduction example: https://github.com/KaotoIO/kaoto-next/ |
Same issue now on 7.5.3 on github actions and only some times also in CLI But kind of strange why i have to this < 7.5.3 worked for me with out any problems and i only have 4 Stories at the moment. |
Same issue here on a 4GB self-hosted runner on Github Actions. Killed with status 137 (OOM) seemingly at random on some jobs. Using the
Other jobs in the same workflow like tests, docker builds, deployments, compilation, etc., are all fine on that same runner so I'd rather not bump up to a larger one just for the sake of getting Storybook to build. Changing the framework as suggested here seemed to yield reliable builds for the time being at least 🤞 edit: unfortunately, |
) Building storybook in CI seems to fail often -- probably due to running out of memory. Changing the compiler to swc might help (according to storybookjs/storybook#6408 (comment)). I don't know what the ramifications of this change may be (I don't even know what storybook is for 😅). So someone with knowledge here should review this PR. --------- Co-authored-by: Howard Braham <[email protected]>
another workaround for this is setting minimize: false on your webpack optimization config, as mentioned here: #20716 |
EDIT: probably related to #28589 Since our upgrade to Storybook 8.2.9, we also get this error when trying to build storybook for production deployment (dev server works just fine)
|
We're using "@storybook/react": "^7.6.19", webpack 5.93.0, and facing the same issue when we switched to
in our
It will go to endless compilation if we try to Perhaps SB somehow overrides how Webpack requires stuff? Because Webpack seems to load and load then runs out of memory |
Describe the bug
When trying to do build-storybook it gets to 92% and then fails with the following out of memory error:
The entirety of my source code is less than 1 MB so not sure why I would be OOM.
To Reproduce
Steps to reproduce the behavior:
Run
yarn build-storybook
Expected behavior
The build shouldn't fail.
Screenshots
If applicable, add screenshots to help explain your problem.
Code snippets
My current webpack.config.js
My current .storybook config.js
I also tried changing the build-storybook command in my package.json to force increase the memory, but that doesn't seem to work either.
"build-storybook": "npx --max_old_space_size=16384 build-storybook"
My full package.json
System:
The text was updated successfully, but these errors were encountered: