Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add @kadira/storybook-addons into resolve.alias. #462

Merged
merged 1 commit into from
Sep 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified dist/server/build.js
100755 → 100644
Empty file.
3 changes: 3 additions & 0 deletions dist/server/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
});
};
Expand Down
21 changes: 11 additions & 10 deletions dist/server/config/defaults/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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')]
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions dist/server/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
}
};

Expand Down
6 changes: 6 additions & 0 deletions dist/server/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
}
};

Expand Down
7 changes: 7 additions & 0 deletions src/server/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,12 @@ export default function (configType, baseConfig, configDir) {
...customConfig.module.loaders || [],
],
},
resolve: {
...customConfig.resolve,
alias: {
...config.alias,
...customConfig.alias,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be ...customConfig.resolve.alias?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. Fixing this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a hotfix. Try now.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, it's resolved!

}
}
};
}
16 changes: 7 additions & 9 deletions src/server/config/defaults/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions src/server/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
6 changes: 6 additions & 0 deletions src/server/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down