angular/angular-cli · error · Error
No options were specified to "postcss-cli-resources".
Error message
No options were specified to "postcss-cli-resources".
What it means
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.
Source
Thrown at packages/angular_devkit/build_angular/src/tools/webpack/plugins/postcss-cli-resources.ts:57
}
async function resolve(
file: string,
base: string,
resolver: (file: string, base: string) => Promise<string>,
): Promise<string> {
try {
return await resolver('./' + file, base);
} catch {
return resolver(file, base);
}
}
export const postcss = true;
export default function (options?: PostcssCliResourcesOptions): Plugin {
if (!options) {
throw new Error('No options were specified to "postcss-cli-resources".');
}
const {
deployUrl = '',
resourcesOutputPath = '',
filename,
loader,
emitFile,
extracted,
} = options;
const process = async (inputUrl: string, context: string, resourceCache: Map<string, string>) => {
// If root-relative, absolute or protocol relative url, leave as is
if (/^((?:\w+:)?\/\/|data:|chrome:|#)/.test(inputUrl)) {
return inputUrl;
}
if (/^\//.test(inputUrl)) {View on GitHub (pinned to bb72145f9a)
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
Example fix
// before
{ loader: 'postcss-loader', options: { plugins: [require('@angular-devkit/build-angular/plugins/postcss-cli-resources')] } }
// after
const postcssCliResources = require('@angular-devkit/build-angular/plugins/postcss-cli-resources').default;
{ loader: 'postcss-loader', options: { plugins: [postcssCliResources({ deployUrl: '', filename: '[name].[hash][ext]', loader: require.resolve('file-loader') })] } } Defensive patterns
Strategy: validation
Validate before calling
const opts = maybeOptions ?? { deployUrl: '', filename: '[name].[hash][ext]', loader: require.resolve('file-loader') };
if (!opts || typeof opts.filename !== 'string') {
throw new Error('postcss-cli-resources requires options incl. filename');
} Type guard
function hasOptions(o?: PostcssCliResourcesOptions): o is PostcssCliResourcesOptions {
return !!o && typeof o === 'object' && typeof o.filename === 'string';
} Try / catch
try {
plugin = postcssCliResources(options);
} catch (err) {
if (String(err.message).includes('No options were specified')) {
plugin = postcssCliResources({ deployUrl: '', filename: '[name].[hash][ext]', loader: defaultLoader });
} else {
throw err;
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Multiple bundles have been named the same: '${duplicates.joi
- Unsupported package manager: "${name}"
- The configured package manager, '${this.descriptor.binary}',
- Project "${project}" does not exist.
- Project target does not exist.
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/f91838e8a0aa7978.
Report an issue: GitHub.