How to use the @kadira/storybook/dist/server/babel_config.default function in @kadira/storybook

To help you get started, we’ve selected a few @kadira/storybook examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github screener-io / screener-storybook / src / storybook / index.js View on Github external
module.exports = function(options, callback) {
  var babel = require('babel-core');
  var configDir = './.storybook';
  var polyfillsPath = require.resolve('./default_config/polyfills.js');
  var loadersPath = require.resolve('./default_config/loaders.js');
  var configPath = path.resolve(configDir, 'config.js');
  var babelConfig = loadBabelConfig(configDir);

  // cacheDir is webpack babel loader specific. We don't run webpack.
  delete babelConfig.cacheDirectory;

  require('babel-register')(babelConfig);
  require('babel-polyfill');

  // load loaders
  var loaders = require(path.resolve(loadersPath));

  Object.keys(loaders).forEach(function(ext) {
    var loader = loaders[ext];
    require.extensions['.' + ext] = function(m, filepath) {
      m.exports = loader(filepath);
    };
  });