Skip to content

Commit

Permalink
Add configType argument to custom config function (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammed Thanish authored and arunoda committed May 6, 2016
1 parent cee0f7b commit 530b7e4
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dist/server/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ _shelljs2.default.mkdir('-p', _path2.default.resolve(outputDir, 'static'));
// Build the webpack configuration using the `baseConfig`
// custom `.babelrc` file and `webpack.config.js` files
var configDir = _commander2.default.configDir || './.storybook';
var config = (0, _config2.default)(_webpackConfig2.default, configDir);
var config = (0, _config2.default)('PRODUCTION', _webpackConfig2.default, configDir);

// Write both the storybook UI and IFRAME HTML files to destination path.
var headHtml = (0, _utils.getHeadHtml)(configDir);
Expand Down
4 changes: 2 additions & 2 deletions dist/server/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var _extends2 = require('babel-runtime/helpers/extends');

var _extends3 = _interopRequireDefault(_extends2);

exports.default = function (baseConfig, configDir) {
exports.default = function (configType, baseConfig, configDir) {
var config = baseConfig;

// search for a .babelrc in the config directory, then the module root directory
Expand Down Expand Up @@ -56,7 +56,7 @@ exports.default = function (baseConfig, configDir) {

if (typeof customConfig === 'function') {
logger.info('=> Loading custom webpack config (full-control mode).');
return customConfig(config);
return customConfig(config, configType);
}

logger.info('=> Loading custom webpack config.');
Expand Down
2 changes: 1 addition & 1 deletion dist/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ if (_commander2.default.staticDir) {
// Build the webpack configuration using the `baseConfig`
// custom `.babelrc` file and `webpack.config.js` files
var configDir = _commander2.default.configDir || './.storybook';
var config = (0, _config2.default)(_webpack4.default, configDir);
var config = (0, _config2.default)('DEVELOPMENT', _webpack4.default, configDir);

var compiler = (0, _webpack2.default)(config);
var devMiddlewareOptions = {
Expand Down
2 changes: 1 addition & 1 deletion src/server/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ shelljs.mkdir('-p', path.resolve(outputDir, 'static'));
// Build the webpack configuration using the `baseConfig`
// custom `.babelrc` file and `webpack.config.js` files
const configDir = program.configDir || './.storybook';
const config = loadConfig(baseConfig, configDir);
const config = loadConfig('PRODUCTION', baseConfig, configDir);

// Write both the storybook UI and IFRAME HTML files to destination path.
const headHtml = getHeadHtml(configDir);
Expand Down
4 changes: 2 additions & 2 deletions src/server/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function loadBabelConfig(babelConfigPath) {
// `baseConfig` is a webpack configuration bundled with storybook.
// React Storybook will look in the `configDir` directory
// (inside working directory) if a config path is not provided.
export default function (baseConfig, configDir) {
export default function (configType, baseConfig, configDir) {
const config = baseConfig;

// search for a .babelrc in the config directory, then the module root directory
Expand Down Expand Up @@ -69,7 +69,7 @@ export default function (baseConfig, configDir) {

if (typeof customConfig === 'function') {
logger.info('=> Loading custom webpack config (full-control mode).');
return customConfig(config);
return customConfig(config, configType);
}

logger.info('=> Loading custom webpack config.');
Expand Down
2 changes: 1 addition & 1 deletion src/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ if (program.staticDir) {
// Build the webpack configuration using the `baseConfig`
// custom `.babelrc` file and `webpack.config.js` files
const configDir = program.configDir || './.storybook';
const config = loadConfig(baseConfig, configDir);
const config = loadConfig('DEVELOPMENT', baseConfig, configDir);

const compiler = webpack(config);
const devMiddlewareOptions = {
Expand Down

0 comments on commit 530b7e4

Please sign in to comment.