parcel-bundler/parcel · error · Error

Only one spread parameter can be included in a config pipeli

Error message

Only one spread parameter can be included in a config pipeline

What it means

In `.parcelrc` pipeline extension, `...` means 'splice the inherited pipeline here'. Parcel flattens nested pipelines by substituting one spread with the parent's flattened pipeline. After substitution it checks for any remaining `...`; a second spread would be ambiguous (which parent? which order?) and is therefore rejected.

Source

Thrown at packages/core/core/src/ParcelConfig.js:431

    for (let pattern in globMap) {
      if (this.isGlobMatch(filePath, pattern)) {
        matches.push(globMap[pattern]);
      }
    }

    let flatten = () => {
      let pipeline = matches.shift() || [];
      let spreadIndex = pipeline.indexOf('...');
      if (spreadIndex >= 0) {
        pipeline = [
          ...pipeline.slice(0, spreadIndex),
          ...flatten(),
          ...pipeline.slice(spreadIndex + 1),
        ];
      }

      if (pipeline.includes('...')) {
        throw new Error(
          'Only one spread parameter can be included in a config pipeline',
        );
      }

      return pipeline;
    };

    let res = flatten();
    // $FlowFixMe afaik this should work
    return res;
  }

  async missingPluginError(
    plugins:
      | GlobMap<ExtendableParcelConfigPipeline>
      | GlobMap<ParcelPluginNode>
      | PureParcelConfigPipeline,
    message: string,

View on GitHub (pinned to 59484858a1)

Solutions

  1. Use exactly one `...` per pipeline and position other transforms around it to control order.
  2. If you need pre- and post-inherited transforms, restructure as nested extended configs.
  3. Inspect the effective pipeline with `parcel show-config` to confirm there is a single spread.

Example fix

// before (.parcelrc)
{
  "transforms": {
    "*.js": ["pre-transform", "...", "post-transform", "..."]
  }
}

// after
{
  "transforms": {
    "*.js": ["pre-transform", "...", "post-transform"]
  }
}
Defensive patterns

Strategy: validation

Validate before calling

// Reject configs with more than one spread before running.
function countSpreads(pipeline: string[]): number {
  return pipeline.filter(s => s === '...').length;
}
if (pipeline.some(countSpreads > 1)) throw new Error('multiple spreads');

Type guard

function hasSingleSpread(pipeline: string[]): boolean {
  return pipeline.filter(s => s === '...').length <= 1;
}

Prevention

When it happens

Trigger: Authoring a `.parcelrc` pipeline (or extended config package) whose pipeline array contains two or more `...` entries.

Common situations: Extending a shared config and trying to inject transforms both before and after inheritance using two spreads.

Related errors


AI-assisted analysis of parcel-bundler/parcel@59484858a1 (2026-08-13). Data as JSON: /api/errors/3401456938170594. Report an issue: GitHub.