UNPKG

702 BJavaScriptView Raw
1function webpack(webpackConfig = {}, options = {}) {
2 const { module = {} } = webpackConfig;
3 const { loaderOptions, rule = {} } = options;
4
5 return {
6 ...webpackConfig,
7 module: {
8 ...module,
9 rules: [
10 ...(module.rules || []),
11 {
12 test: [/\.stories\.(jsx?$|tsx?$)/],
13 ...rule,
14 enforce: 'pre',
15 use: [
16 {
17 loader: require.resolve('@storybook/source-loader'),
18 options: loaderOptions,
19 },
20 ],
21 },
22 ],
23 },
24 };
25}
26
27function managerEntries(entry = []) {
28 return [...entry, require.resolve('./dist/esm/manager')];
29}
30
31module.exports = { webpack, managerEntries };