Storybook does not work - regeneratorRuntime
Closed this issue · 1 comments
Removing this line of code from LoginSession.js breaks storybook:
import 'regenerator-runtime/runtime';
Omitting this line does not break the frontend code, only storybook
This method of importing (similar to a php include
statement) is pretty non-standard in our codebase and will add a global variable regeneratorRuntime
to the CMS. However we only want this for storybook, not the frontend.
This issue on babel/babel explains why it's needed for inner async functions
We have an inner async function in order to utilise the @silverstripe/reactstrap-confirm component which itself uses the ^7 version of @babel/runtime-transform-plugin
- package.json. That is why the frontend still works.
The correct place to globally expose regeneratorRuntime would be as a dev only dependency on admin
PRs
Sorted by properly including babel-runtime
as dependency and babel-plugin-transform-runtime
as a --dev dependency, and updated .babelrc
to include the plugin