2021-07-09 11:50:23 +02:00
|
|
|
function config(entry = []) {
|
2021-08-16 21:21:04 +02:00
|
|
|
return [...entry, require.resolve('./dist/esm/preset/preview')];
|
2021-07-09 11:50:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function managerEntries(entry = []) {
|
2021-08-16 21:21:04 +02:00
|
|
|
return [...entry, require.resolve('./dist/esm/preset/manager')];
|
2021-07-09 11:50:23 +02:00
|
|
|
}
|
|
|
|
|
2021-08-27 23:06:07 +02:00
|
|
|
function webpack(config = {}, options = {}) {
|
|
|
|
const sourceLoader = {
|
|
|
|
loader: require.resolve('@storybook/source-loader'),
|
|
|
|
options: options.loaderOptions,
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
...config,
|
|
|
|
module: {
|
|
|
|
...config.module,
|
|
|
|
rules: [
|
|
|
|
...(config.module?.rules || []),
|
|
|
|
{
|
|
|
|
test: [/\.stories\.(jsx?$|tsx?$)/],
|
|
|
|
...options.rule,
|
|
|
|
enforce: 'pre',
|
|
|
|
use: [sourceLoader],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-07-09 11:50:23 +02:00
|
|
|
module.exports = {
|
|
|
|
config,
|
2021-08-27 23:06:07 +02:00
|
|
|
managerEntries,
|
|
|
|
webpack,
|
2021-07-09 11:50:23 +02:00
|
|
|
};
|