@storybook/addon-styling-webpack
Version:
A base addon for configuring popular styling tools in Webpack
1 lines • 1.01 kB
JavaScript
;var nodeLogger=require('storybook/internal/node-logger');var r=t=>t.test instanceof RegExp&&(t.test.test("test.css")||t.test.test("test.scss")||t.test.test("test.less"));function p(t,{rules:o,plugins:e}={}){if(nodeLogger.logger.info(`=> [${nodeLogger.colors.pink("@storybook/addon-styling-webpack")}] Applying custom Storybook webpack configuration styling.`),e&&e.length&&(nodeLogger.logger.info(`=> [${nodeLogger.colors.pink("@storybook/addon-styling-webpack")}] Adding given plugins to Storybook webpack configuration.`),t.plugins=t.plugins||[],t.plugins.push(...e)),o&&o.length){if(nodeLogger.logger.info(`=> [${nodeLogger.colors.pink("@storybook/addon-styling-webpack")}] Replacing Storybook's webpack rules for styles with given rules.`),!t.module?.rules)throw new Error("webpackFinal received a rules option but config.module.rules is not an array");t.module.rules=t.module.rules.filter(s=>typeof s=="object"&&s&&!r(s)),t.module.rules?.push(...o);}return t}var b=p;exports.webpackFinal=b;