How to use the @storybook/core/server.createDefaultWebpackConfig function in @storybook/core

To help you get started, we’ve selected a few @storybook/core 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 wix / wix-react-native-storybook-template / storybook-react-native / server / config.js View on Github external
config.module.rules[0].query.cacheDirectory = findCacheDir({
    name: 'react-storybook',
  });

  // Check whether addons.js file exists inside the storybook.
  // Load the default addons.js file if it's missing.
  const storybookDefaultAddonsPath = path.resolve(__dirname, 'addons.js');
  const storybookCustomAddonsPath = path.resolve(configDir, 'addons.js');
  if (fs.existsSync(storybookCustomAddonsPath)) {
    logger.info('=> Loading custom addons config.');
    config.entry.manager.unshift(storybookCustomAddonsPath);
  } else {
    config.entry.manager.unshift(storybookDefaultAddonsPath);
  }

  const defaultConfig = createDefaultWebpackConfig(config);

  // Check whether user has a custom webpack config file and
  // return the (extended) base configuration if it's not available.
  const customConfigPath = path.resolve(configDir, 'webpack.config.js');
  if (!fs.existsSync(customConfigPath)) {
    logger.info('=> Using default webpack setup based on "Create React App".');
    return defaultConfig;
  }

  const customConfig = require(customConfigPath); // eslint-disable-line

  if (typeof customConfig === 'function') {
    logger.info('=> Loading custom webpack config (full-control mode).');
    return customConfig(config, configType, defaultConfig);
  }
github storybookjs / storybook / app / react-native / src / server / config.js View on Github external
config.module.rules[0].query.cacheDirectory = findCacheDir({
    name: 'react-storybook',
  });

  // Check whether addons.js file exists inside the storybook.
  // Load the default addons.js file if it's missing.
  const storybookDefaultAddonsPath = path.resolve(__dirname, 'addons.js');
  const storybookCustomAddonsPath = path.resolve(configDir, 'addons.js');
  if (fs.existsSync(storybookCustomAddonsPath)) {
    logger.info('=> Loading custom addons config.');
    config.entry.manager.unshift(storybookCustomAddonsPath);
  } else {
    config.entry.manager.unshift(storybookDefaultAddonsPath);
  }

  const defaultConfig = createDefaultWebpackConfig(config);

  // Check whether user has a custom webpack config file and
  // return the (extended) base configuration if it's not available.
  const customConfigPath = path.resolve(configDir, 'webpack.config.js');
  if (!fs.existsSync(customConfigPath)) {
    logger.info('=> Using default webpack setup based on "Create React App".');
    return defaultConfig;
  }

  const customConfig = require(customConfigPath); // eslint-disable-line

  if (typeof customConfig === 'function') {
    logger.info('=> Loading custom webpack config (full-control mode).');
    return customConfig(config, configType, defaultConfig);
  }
github storybookjs / storybook / app / polymer / src / server / config / defaults / webpack.config.js View on Github external
module.exports = storybookBaseConfig =>
  createDefaultWebpackConfig(storybookBaseConfig, includePaths);
github cennznet / runanode / .storybook / webpack.config.js View on Github external
module.exports = (baseConfig, configType) => when(
  always(configType !== 'PRODUCTION' && hotReloadDisabled),
  evolve({
    entry: {
      preview: filter(complement(includes('webpack-hot-middleware'))),
    },
    plugins: filter(plugin => plugin.constructor.name !== 'HotModuleReplacementPlugin'),
  }),
  createDefaultWebpackConfig(baseConfig),
);