LoginSignup
3
0

More than 5 years have passed since last update.

React Storybookで 'regeneratorRuntime is not defined' と怒られる

Last updated at Posted at 2017-05-10

Storybookにもbabel-polyfillを追加する。

.storybook/webpack.config.jsを以下の内容で作成。

webpack.config.js
module.exports = function(storybookBaseConfig, configType) {
  storybookBaseConfig.entry.preview.unshift('babel-polyfill')
}

Storybook 2.21.0で確認

おまけ

自分のプロジェクトでは、babel適用のコードは.es6という拡張子で書いているので、以下のようになる

webpack.config.js
module.exports = function(storybookBaseConfig, configType) {
  storybookBaseConfig.entry.preview.unshift('babel-polyfill')

  storybookBaseConfig.resolve.extensions.unshift('.es6')
  storybookBaseConfig.module.loaders.push({
    test: /\.es6$/,
    exclude: /node_modules/,
    loader: 'babel',
  })

  return storybookBaseConfig;
}
3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0