{"record":{"id":"f91838e8a0aa7978","repo":"angular/angular-cli","slug":"no-options-were-specified-to-postcss-cli-resource","errorCode":null,"errorMessage":"No options were specified to \"postcss-cli-resources\".","messagePattern":"No options were specified to \"postcss-cli-resources\"\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/angular_devkit/build_angular/src/tools/webpack/plugins/postcss-cli-resources.ts","lineNumber":57,"sourceCode":"}\n\nasync function resolve(\n  file: string,\n  base: string,\n  resolver: (file: string, base: string) => Promise<string>,\n): Promise<string> {\n  try {\n    return await resolver('./' + file, base);\n  } catch {\n    return resolver(file, base);\n  }\n}\n\nexport const postcss = true;\n\nexport default function (options?: PostcssCliResourcesOptions): Plugin {\n  if (!options) {\n    throw new Error('No options were specified to \"postcss-cli-resources\".');\n  }\n\n  const {\n    deployUrl = '',\n    resourcesOutputPath = '',\n    filename,\n    loader,\n    emitFile,\n    extracted,\n  } = options;\n\n  const process = async (inputUrl: string, context: string, resourceCache: Map<string, string>) => {\n    // If root-relative, absolute or protocol relative url, leave as is\n    if (/^((?:\\w+:)?\\/\\/|data:|chrome:|#)/.test(inputUrl)) {\n      return inputUrl;\n    }\n\n    if (/^\\//.test(inputUrl)) {","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/build_angular/src/tools/webpack/plugins/postcss-cli-resources.ts#L39-L75","documentation":"postcss-cli-resources is a postcss plugin factory exported from build-angular; it expects a PostcssCliResourcesOptions object (deployUrl, filename, loader, etc.). It is called with no options and immediately throws instead of silently using defaults, because without at least a filename/loader the plugin cannot resolve url() references. The thrown message quotes the plugin name for searchability.","triggerScenarios":"Registering the plugin in a postcss config as `require('.../postcss-cli-resources')()` or passing it bare in a webpack postcss-loader plugins array with zero arguments.","commonSituations":"Hand-wiring custom webpack configs that copy the CLI's stylesheet pipeline but omit the options object; postcss.config.js setups that call the default export without arguments; older docs/snippets showing plugin usage without parameters.","solutions":["Pass an options object: postcssCliResources({ deployUrl, loader, filename: '[name].[ext]' }) in your postcss-loader plugins array","If you do not need asset-rewriting of url() references, remove the plugin from your postcss config entirely","Confirm you are calling the default export as a factory (it returns a postcss Plugin), not registering the module itself as a plugin"],"exampleFix":"// before\n{ loader: 'postcss-loader', options: { plugins: [require('@angular-devkit/build-angular/plugins/postcss-cli-resources')] } }\n// after\nconst postcssCliResources = require('@angular-devkit/build-angular/plugins/postcss-cli-resources').default;\n{ loader: 'postcss-loader', options: { plugins: [postcssCliResources({ deployUrl: '', filename: '[name].[hash][ext]', loader: require.resolve('file-loader') })] } }","handlingStrategy":"validation","validationCode":"const opts = maybeOptions ?? { deployUrl: '', filename: '[name].[hash][ext]', loader: require.resolve('file-loader') };\nif (!opts || typeof opts.filename !== 'string') {\n  throw new Error('postcss-cli-resources requires options incl. filename');\n}","typeGuard":"function hasOptions(o?: PostcssCliResourcesOptions): o is PostcssCliResourcesOptions {\n  return !!o && typeof o === 'object' && typeof o.filename === 'string';\n}","tryCatchPattern":"try {\n  plugin = postcssCliResources(options);\n} catch (err) {\n  if (String(err.message).includes('No options were specified')) {\n    plugin = postcssCliResources({ deployUrl: '', filename: '[name].[hash][ext]', loader: defaultLoader });\n  } else {\n    throw err;\n  }\n}","preventionTips":["Never register the plugin without an options object","Wrap factory calls in helper functions with defaults","Validate that filename/loader are provided when wiring webpack configs","Prefer the CLI's built-in stylesheet pipeline over hand-rolled postcss setups"],"tags":["postcss","webpack","angular-cli","configuration"],"backgroundTag":"missing-plugin-options","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}