mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-31 05:03:21 +08:00
32 lines
703 B
JavaScript
32 lines
703 B
JavaScript
function webpack(webpackConfig = {}, options = {}) {
|
|
const { module = {} } = webpackConfig;
|
|
const { loaderOptions, rule = {} } = options;
|
|
|
|
return {
|
|
...webpackConfig,
|
|
module: {
|
|
...module,
|
|
rules: [
|
|
...(module.rules || []),
|
|
{
|
|
test: [/\.stories\.(jsx?$|tsx?$)/],
|
|
...rule,
|
|
enforce: 'pre',
|
|
use: [
|
|
{
|
|
loader: require.resolve('@storybook/source-loader'),
|
|
options: loaderOptions,
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
};
|
|
}
|
|
|
|
function managerEntries(entry = []) {
|
|
return [...entry, require.resolve('./dist/esm/register')];
|
|
}
|
|
|
|
module.exports = { webpack, managerEntries };
|