parcel-bundler/parcel · error · Error

Unsupported output format: ${b.env.outputFormat}

Error message

Unsupported output format: ${b.env.outputFormat}

What it means

Thrown by @parcel/runtime-rsc when generating the runtime glue for a bundle group whose sibling bundle has an outputFormat other than 'esmodule' or 'commonjs'. The RSC runtime emits either `parcelRequire.load(...)` (ESM) or `__parcel__require__(...)` (CJS); any other format ('global'/'iife'/undefined) has no codegen path. The check is per sibling bundle in the same context as the parent.

Source

Thrown at packages/runtimes/rsc/src/RSCRuntime.js:273

                  }
                  bootstrapModules.push(url);
                  Object.assign(importMap, getImportMap(bundleGraph, b));
                }

                if (b.env.context === bundle.env.context) {
                  if (b.env.outputFormat === 'esmodule') {
                    js.push(
                      `parcelRequire.load(${JSON.stringify(b.publicId)})`,
                    );
                  } else if (b.env.outputFormat === 'commonjs') {
                    let relativePath = JSON.stringify(
                      relativeBundlePath(bundle, b),
                    );
                    js.push(
                      `Promise.resolve(__parcel__require__(${relativePath}))`,
                    );
                  } else {
                    throw new Error(
                      'Unsupported output format: ' + b.env.outputFormat,
                    );
                  }
                }

                // Find the client entry in this bundle group if any.
                if (bundle.env.isServer() && b.env.isBrowser() && !entry) {
                  b.traverseAssets((a, ctx, actions) => {
                    if (
                      Array.isArray(a.meta.directives) &&
                      a.meta.directives.includes('use client-entry')
                    ) {
                      entry = a;
                      actions.stop();
                    }
                  });
                }
              }

View on GitHub (pinned to 59484858a1)

Solutions

  1. Use scope hoisting (default in production) so RSC bundles emit ESM/CJS rather than global.
  2. Set the relevant target's outputFormat to 'esmodule' or 'commonjs' in .parcelrc or package.json targets.
  3. Avoid library/isLibrary mode for RSC bundles unless you explicitly control outputFormat.
  4. Audit .parcelrc and targets to ensure no transformer/runtime forces 'global' on RSC sub-bundles.

Example fix

// before: package.json targets
"targets": {
  "main": { "context": "react-server", "outputFormat": "global" }
}
// after
"targets": {
  "main": { "context": "react-server", "outputFormat": "esmodule", "scopeHoist": true }
}
Defensive patterns

Strategy: validation

Validate before calling

// Validate RSC target outputFormat before building
const ALLOWED = new Set(['esmodule', 'commonjs']);
function validateRSCTargets(targets) {
  for (const [name, t] of Object.entries(targets)) {
    if (t.context === 'react-server' && !ALLOWED.has(t.outputFormat)) {
      throw new Error(`target ${name}: react-server outputFormat must be esmodule or commonjs (got ${t.outputFormat})`);
    }
  }
}

Prevention

When it happens

Trigger: An RSC build where a bundle reached the runtime-rsc codegen step with outputFormat === 'global' (the third common Parcel format) or undefined. Typical when scope hoisting is off or a target forces global/IIFE output for a sub-bundle that ends up referenced from an RSC bundle group.

Common situations: Setting the target outputFormat to 'global' (or leaving default in non-scope-hoist mode) for a React Server Components build; mixing an ESM/CJS RSC bundle with a sibling bundle built for a UMD/global context; library mode misconfigured for RSC.

Related errors


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