( match: CompleteLoader, loaderOptions: Configure<any, BaseContext>, context: BaseContext )
| 94 | } |
| 95 | |
| 96 | function applyLoaderOptions( |
| 97 | match: CompleteLoader, |
| 98 | loaderOptions: Configure<any, BaseContext>, |
| 99 | context: BaseContext |
| 100 | ) { |
| 101 | if (isFunction(loaderOptions)) { |
| 102 | match.loader.options = loaderOptions(match.loader.options || {}, context); |
| 103 | |
| 104 | if (!match.loader.options) { |
| 105 | throw new Error( |
| 106 | "craco: 'style.postcss.loaderOptions' function didn't return a loader config object." |
| 107 | ); |
| 108 | } |
| 109 | } else { |
| 110 | // TODO: ensure is otherwise a plain object, if not, log an error. |
| 111 | match.loader.options = deepMergeWithArray( |
| 112 | {}, |
| 113 | match.loader.options || {}, |
| 114 | loaderOptions |
| 115 | ); |
| 116 | } |
| 117 | |
| 118 | log('Applied PostCSS loaders options.'); |
| 119 | } |
| 120 | |
| 121 | function overrideLoader( |
| 122 | match: CompleteLoader, |
no test coverage detected
searching dependent graphs…