diff --git a/dist/client/ui/admin.js b/dist/client/ui/admin.js index 4a0f666a7ba6..aa2cae908729 100644 --- a/dist/client/ui/admin.js +++ b/dist/client/ui/admin.js @@ -34,7 +34,7 @@ var _action_logger = require('./action_logger'); var _action_logger2 = _interopRequireDefault(_action_logger); -var _layout = require('./layout'); +var _layout = require('layout'); var _layout2 = _interopRequireDefault(_layout); diff --git a/dist/server/index.js b/dist/server/index.js index 197302a7007f..2cb25d628a06 100755 --- a/dist/server/index.js +++ b/dist/server/index.js @@ -105,6 +105,13 @@ if (!_fs2.default.existsSync(storybookConfigPath)) { } _webpack4.default.entry.preview.push(storybookConfigPath); +var layoutPath = '../ui/layout'; +var customLayoutPath = _path2.default.resolve(configDirPath, 'layout.js'); +if (_fs2.default.existsSync(customLayoutPath)) { + logger.info('=> Using custom layout.'); + layoutPath = customLayoutPath; +} + // load custom webpack configurations var customConfigPath = _path2.default.resolve(configDirPath, 'webpack.config.js'); var finalConfig = _webpack4.default; @@ -117,7 +124,12 @@ if (_fs2.default.existsSync(customConfigPath)) { module: (0, _extends3.default)({}, _webpack4.default.module, { // We need to use our and custom loaders. loaders: [].concat((0, _toConsumableArray3.default)(_webpack4.default.module.loaders), (0, _toConsumableArray3.default)(customConfig.module.loaders || [])) - }) + }), + resolve: { + alias: { + layout: layoutPath + } + } }); } diff --git a/src/client/ui/admin.js b/src/client/ui/admin.js index 84fbc901117f..5eb1a232eb43 100644 --- a/src/client/ui/admin.js +++ b/src/client/ui/admin.js @@ -3,7 +3,7 @@ import ReactDOM from 'react-dom'; import stringify from 'json-stringify-safe'; import StorybookControls from './controls'; import ActionLogger from './action_logger'; -import Layout from './layout'; +import Layout from 'layout'; import { getSyncedStore } from '../'; const rootEl = document.getElementById('root'); diff --git a/src/server/index.js b/src/server/index.js index 56aaddf1f1ee..49062559877b 100755 --- a/src/server/index.js +++ b/src/server/index.js @@ -67,6 +67,13 @@ if (!fs.existsSync(storybookConfigPath)) { } config.entry.preview.push(storybookConfigPath); +let layoutPath = '../ui/layout'; +const customLayoutPath = path.resolve(configDirPath, 'layout.js'); +if (fs.existsSync(customLayoutPath)) { + logger.info('=> Using custom layout.'); + layoutPath = customLayoutPath +} + // load custom webpack configurations const customConfigPath = path.resolve(configDirPath, 'webpack.config.js'); let finalConfig = config; @@ -91,6 +98,11 @@ if (fs.existsSync(customConfigPath)) { ...customConfig.module.loaders || [], ], }, + resolve: { + alias: { + layout: layoutPath + } + } }; }