diff --git a/dist/server/build.js b/dist/server/build.js old mode 100755 new mode 100644 diff --git a/dist/server/config.js b/dist/server/config.js index 63ee57504d13..8674fcf74bfd 100644 --- a/dist/server/config.js +++ b/dist/server/config.js @@ -78,6 +78,9 @@ exports.default = function (configType, baseConfig, configDir) { plugins: [].concat((0, _toConsumableArray3.default)(config.plugins), (0, _toConsumableArray3.default)(customConfig.plugins || [])), module: (0, _extends3.default)({}, config.module, customConfig.module, { loaders: [].concat((0, _toConsumableArray3.default)(config.module.loaders), (0, _toConsumableArray3.default)(customConfig.module.loaders || [])) + }), + resolve: (0, _extends3.default)({}, customConfig.resolve, { + alias: (0, _extends3.default)({}, config.alias, customConfig.alias) }) }); }; diff --git a/dist/server/config/defaults/webpack.config.js b/dist/server/config/defaults/webpack.config.js index 742675e06c13..57e2b42b4e59 100644 --- a/dist/server/config/defaults/webpack.config.js +++ b/dist/server/config/defaults/webpack.config.js @@ -4,6 +4,10 @@ var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray'); var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2); +var _extends2 = require('babel-runtime/helpers/extends'); + +var _extends3 = _interopRequireDefault(_extends2); + var _autoprefixer = require('autoprefixer'); var _autoprefixer2 = _interopRequireDefault(_autoprefixer); @@ -14,8 +18,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de // Add a default custom config which is similar to what React Create App does. module.exports = function (storybookBaseConfig) { - var newConfig = storybookBaseConfig; - newConfig.module.loaders = [].concat((0, _toConsumableArray3.default)(newConfig.module.loaders), [{ + var newConfig = (0, _extends3.default)({}, storybookBaseConfig); + newConfig.module.loaders = [].concat((0, _toConsumableArray3.default)(storybookBaseConfig.module.loaders), [{ test: /\.css?$/, include: _utils.includePaths, loaders: [require.resolve('style-loader'), require.resolve('css-loader'), require.resolve('postcss-loader')] @@ -46,14 +50,11 @@ module.exports = function (storybookBaseConfig) { })]; }; - newConfig.resolve = { - // These are the reasonable defaults supported by the Node ecosystem. - extensions: ['.js', '.json', ''], - alias: { - // This is to support NPM2 - 'babel-runtime/regenerator': require.resolve('babel-runtime/regenerator') - } - }; + newConfig.resolve.extensions = ['.js', '.json', '']; + newConfig.resolve.alias = (0, _extends3.default)({}, storybookBaseConfig.resolve.alias, { + // This is to support NPM2 + 'babel-runtime/regenerator': require.resolve('babel-runtime/regenerator') + }); // Return the altered config return newConfig; diff --git a/dist/server/config/webpack.config.js b/dist/server/config/webpack.config.js index b0db11aa03d4..d9dd9d496298 100644 --- a/dist/server/config/webpack.config.js +++ b/dist/server/config/webpack.config.js @@ -48,6 +48,12 @@ var config = { include: _utils.includePaths, exclude: _utils.excludePaths }] + }, + resolve: { + alias: { + // This is to add addon support for NPM2 + '@kadira/storybook-addons': require.resolve('@kadira/storybook-addons') + } } }; diff --git a/dist/server/config/webpack.config.prod.js b/dist/server/config/webpack.config.prod.js index fb26b847a630..e57029727552 100644 --- a/dist/server/config/webpack.config.prod.js +++ b/dist/server/config/webpack.config.prod.js @@ -59,6 +59,12 @@ var config = { include: _utils.includePaths, exclude: _utils.excludePaths }] + }, + resolve: { + alias: { + // This is to add addon support for NPM2 + '@kadira/storybook-addons': require.resolve('@kadira/storybook-addons') + } } }; diff --git a/src/server/config.js b/src/server/config.js index e75ccceea4f1..030df867e333 100644 --- a/src/server/config.js +++ b/src/server/config.js @@ -132,5 +132,12 @@ export default function (configType, baseConfig, configDir) { ...customConfig.module.loaders || [], ], }, + resolve: { + ...customConfig.resolve, + alias: { + ...config.alias, + ...customConfig.alias, + } + } }; } diff --git a/src/server/config/defaults/webpack.config.js b/src/server/config/defaults/webpack.config.js index ed319a3420a3..38945a0ebb73 100644 --- a/src/server/config/defaults/webpack.config.js +++ b/src/server/config/defaults/webpack.config.js @@ -3,9 +3,9 @@ import { includePaths } from '../utils'; // Add a default custom config which is similar to what React Create App does. module.exports = (storybookBaseConfig) => { - const newConfig = storybookBaseConfig; + const newConfig = { ...storybookBaseConfig }; newConfig.module.loaders = [ - ...newConfig.module.loaders, + ...storybookBaseConfig.module.loaders, { test: /\.css?$/, include: includePaths, @@ -52,13 +52,11 @@ module.exports = (storybookBaseConfig) => { ]; }; - newConfig.resolve = { - // These are the reasonable defaults supported by the Node ecosystem. - extensions: ['.js', '.json', ''], - alias: { - // This is to support NPM2 - 'babel-runtime/regenerator': require.resolve('babel-runtime/regenerator'), - }, + newConfig.resolve.extensions = ['.js', '.json', '']; + newConfig.resolve.alias = { + ...storybookBaseConfig.resolve.alias, + // This is to support NPM2 + 'babel-runtime/regenerator': require.resolve('babel-runtime/regenerator'), }; // Return the altered config diff --git a/src/server/config/webpack.config.js b/src/server/config/webpack.config.js index f7ae029b760f..8b86b04088cd 100644 --- a/src/server/config/webpack.config.js +++ b/src/server/config/webpack.config.js @@ -47,6 +47,12 @@ const config = { }, ], }, + resolve: { + alias: { + // This is to add addon support for NPM2 + '@kadira/storybook-addons': require.resolve('@kadira/storybook-addons'), + } + } }; export default config; diff --git a/src/server/config/webpack.config.prod.js b/src/server/config/webpack.config.prod.js index 63982e1ddf4f..08cd704196d9 100644 --- a/src/server/config/webpack.config.prod.js +++ b/src/server/config/webpack.config.prod.js @@ -54,6 +54,12 @@ const config = { }, ], }, + resolve: { + alias: { + // This is to add addon support for NPM2 + '@kadira/storybook-addons': require.resolve('@kadira/storybook-addons'), + } + } }; // Webpack 2 doesn't have a OccurenceOrderPlugin plugin in the production mode.