mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-09 00:19:13 +08:00
Add @kadira/storybook-addons into resolve.alias. (#462)
Then addons will work on NPM2 properly.
This commit is contained in:
parent
82cace8df3
commit
18ac324a90
0
dist/server/build.js
vendored
Executable file → Normal file
0
dist/server/build.js
vendored
Executable file → Normal file
3
dist/server/config.js
vendored
3
dist/server/config.js
vendored
@ -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)
|
||||
})
|
||||
});
|
||||
};
|
||||
|
21
dist/server/config/defaults/webpack.config.js
vendored
21
dist/server/config/defaults/webpack.config.js
vendored
@ -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;
|
||||
|
6
dist/server/config/webpack.config.js
vendored
6
dist/server/config/webpack.config.js
vendored
@ -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')
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
6
dist/server/config/webpack.config.prod.js
vendored
6
dist/server/config/webpack.config.prod.js
vendored
@ -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')
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -132,5 +132,12 @@ export default function (configType, baseConfig, configDir) {
|
||||
...customConfig.module.loaders || [],
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
...customConfig.resolve,
|
||||
alias: {
|
||||
...config.alias,
|
||||
...customConfig.alias,
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user