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.

I’m using a vanilla setup of StoryBook with no tweaks to babel. If I use async/await I get an error of:

regeneratorRuntime is not defined

Typically the babel-polyfill is required to have async/await work on the client. What are the steps to get this working within StoryBook?

I tried importing babel-polyfill within the .storybook/config.js but to no avail.

Thanks.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

49reactions
dziamidcommented, Apr 26, 2017
//.storybook/config.js
import 'babel-polyfill';
7reactions
nicolasartmancommented, Nov 28, 2016

@kgoggin I solved a very similar issue just now (regeneratorRuntime was expected in the global scope by redux-form-saga so it borked storybook) by simply manually adding regeneratorRuntime to the global scope in config.js (window.regeneratorRuntime = require('babel-runtime/regenerator');). I don’t like this solution and plan to investigate further later, but if you’re looking for a quick workaround perhaps that’ll help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Async/await - The Modern JavaScript Tutorial
The async keyword before a function has two effects: ... The await keyword before a promise makes JavaScript wait until that promise settles,...
Read more >
asyncawait - npm
Start using asyncawait in your project by running `npm i asyncawait`. There are 117 other projects in the npm registry using asyncawait.
Read more >
yortus/asyncawait: Callback heaven for Node.js with async/await
This library has enabled async/await coding style in Node.js since 2014. But JavaScript now has native async/await. JS async/await was standardized as part ......
Read more >
Mastering Async/Await
No more deeply nested callbacks or convoluted promise chains. With async/await, you can make that dream a reality. Mastering Async/Await provides a concise...
Read more >
AsyncAwait - deferred subroutine syntax for futures - MetaCPAN
This module provides syntax for deferring and resuming subroutines while waiting for Futures to complete. This syntax aims to make code that performs ......
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