question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] TypeError: previewBuilder.bail is not a function

See original GitHub issue

What version of vite are you using?

3.0.9

System info and storybook versions

  System:
    OS: macOS 12.5.1
    CPU: (10) arm64 Apple M1 Max
  Binaries:
    Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
    Yarn: 3.1.0 - ~/.nvm/versions/node/v16.16.0/bin/yarn
    npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
  Browsers:
    Chrome: 104.0.5112.101
    Firefox: 103.0.1
    Safari: 15.6.1
  npmPackages:
    @storybook/addon-actions: ^6.5.10 => 6.5.10 
    @storybook/addon-essentials: ^6.5.10 => 6.5.10 
    @storybook/addon-storyshots: ^6.5.10 => 6.5.10 
    @storybook/builder-vite: ^0.2.2 => 0.2.2 
    @storybook/node-logger: ^6.5.10 => 6.5.10 
    @storybook/preset-create-react-app: ^4.1.2 => 4.1.2 
    @storybook/react: ^6.5.10 => 6.5.10 

Describe the Bug

If I run start-storybook, it fails the first time, works the second, but with some errors about my Flow annotations, and works just fine the third time…

build-storybook always fails:

❯ build-storybook
info @storybook/react v6.5.10
info 
info => Cleaning outputDir: /Users/federicozivolo/Developer/frontend/storybook-static
info => Loading presets
info => Copying static files: /Users/federicozivolo/Developer/frontend/public at /Users/federicozivolo/Developer/frontend/storybook-static/
info => Compiling manager..
ERR! TypeError: previewBuilder.bail is not a function
ERR!     at /Users/federicozivolo/Developer/frontend/node_modules/@storybook/core-server/dist/cjs/build-static.js:219:26
ERR!     at async Promise.all (index 0)
ERR!     at async buildStaticStandalone (/Users/federicozivolo/Developer/frontend/node_modules/@storybook/core-server/dist/cjs/build-static.js:218:28)
ERR!     at async buildStatic (/Users/federicozivolo/Developer/frontend/node_modules/@storybook/core-server/dist/cjs/build-static.js:254:5)
ERR!  TypeError: previewBuilder.bail is not a function
ERR!     at /Users/federicozivolo/Developer/frontend/node_modules/@storybook/core-server/dist/cjs/build-static.js:219:26
ERR!     at async Promise.all (index 0)
ERR!     at async buildStaticStandalone (/Users/federicozivolo/Developer/frontend/node_modules/@storybook/core-server/dist/cjs/build-static.js:218:28)
ERR!     at async buildStatic (/Users/federicozivolo/Developer/frontend/node_modules/@storybook/core-server/dist/cjs/build-static.js:254:5)
info => Loading presets

Link to Minimal Reproducible Example

No response

Participation

  • I am willing to submit a pull request for this issue.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
joshwoodingcommented, Oct 27, 2022

@shadow7412 0.2.5 has now been released 🎉

1reaction
IanVScommented, Aug 24, 2022

Webpack is still used for the “manager” part of storybook (the sidebar, addons panel, toolbar, etc), at least until storybook 7 is released.

This looks like a bug in the vite-builder, but I’m not sure why we’ve never hit it before.

In the meantime, I think your config will also cause some problems. If you merge in your vite plugins to the storybook config, you will have duplicate react plugins.

I saw your latest comment, glad that was the issue. But yes, we should still fix the bail issue.

As for the memory, we find that vite requires a lot of memory to build, and storybook together with it adds even more. You can normally use --max-old-space-size to increase the memory available to node while building.

Read more comments on GitHub >

github_iconTop Results From Across the Web

previewBuilder.bail is not a function · Issue #19349 - GitHub
Hey! I recently upgraded from v7.0.0-alpha.33 -> .34 in order to get around a bug that was patched with this PR. npm run...
Read more >
Storybook + Vite Shows "No Preview" But still renders story
Storybook functions well despite this, but having the false negatives is not ideal. Has anyone ran into this and found a suitable reasoning...
Read more >
Reviewing Build 565 • storybookjs/design-system - Chromatic
View latest build. Error stack trace View in Storybook. Error: Evaluation failed: TypeError: original is not a function at finalStoryFn ...
Read more >
How to handle yarn's parse error - DEV Community ‍ ‍
Cannot parse records: Unexpected end of JSON input while parsing near '' ERR! TypeError: previewBuilder.bail is not a function ERR! at /var/www/ ...
Read more >
Unable to host static build on sub folder #7775 - Issuehunt
But i got build errors : TypeError: previewBuilder.bail is not a function. Basically i have a root website where i serve the stable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found