Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.option('--extension [string]', 'File extension to use for storyshot files. Default is `.shot`')
.option('--polyfills [string]', 'Add global polyfills')
.option('--loaders [string]', 'Add loaders')
.parse(process.argv);
const {
configDir = './.storybook',
polyfills: polyfillsPath = require.resolve('./default_config/polyfills.js'),
loaders: loadersPath = require.resolve('./default_config/loaders.js'),
grep,
exclude,
} = program;
const configPath = path.resolve(configDir, 'config.js');
const 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
const loaders = require(path.resolve(loadersPath));
Object.keys(loaders).forEach(ext => {
const loader = loaders[ext];
require.extensions[`.${ext}`] = (m, filepath) => {
m.exports = loader(filepath);
};
})