{"record":{"id":"085551825a39df2d","repo":"parcel-bundler/parcel","slug":"the-global-output-format-is-not-supported-in-the","errorCode":null,"errorMessage":"The \"global\" output format is not supported in the \"${targetName}\" target.","messagePattern":"The \"global\" output format is not supported in the \"(.+?)\" target\\.","errorType":"exception","errorClass":"ThrowableDiagnostic","httpStatus":null,"severity":"error","filePath":"packages/core/core/src/requests/TargetRequest.js","lineNumber":774,"sourceCode":"                  ]),\n                },\n              ],\n              hints: [\n                `The \"${targetName}\" field is meant for libraries. If you meant to output a ${ext} file, either remove the \"${targetName}\" field or choose a different target name.`,\n              ],\n              documentationURL:\n                'https://parceljs.org/features/targets/#library-targets',\n            },\n          });\n        }\n\n        if (descriptor.outputFormat === 'global') {\n          let contents: string =\n            typeof pkgContents === 'string'\n              ? pkgContents\n              : // $FlowFixMe\n                JSON.stringify(pkgContents, null, '\\t');\n          throw new ThrowableDiagnostic({\n            diagnostic: {\n              message: md`The \"global\" output format is not supported in the \"${targetName}\" target.`,\n              origin: '@parcel/core',\n              codeFrames: [\n                {\n                  language: 'json',\n                  filePath: pkgFilePath ?? undefined,\n                  code: contents,\n                  codeHighlights: generateJSONCodeHighlights(contents, [\n                    {\n                      key: `/targets/${targetName}/outputFormat`,\n                      type: 'value',\n                    },\n                  ]),\n                },\n              ],\n              hints: [\n                `The \"${targetName}\" field is meant for libraries. The outputFormat must be either \"commonjs\" or \"esmodule\". Either change or remove the declared outputFormat.`,","sourceCodeStart":756,"sourceCodeEnd":792,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/core/core/src/requests/TargetRequest.js#L756-L792","documentation":"The `global` outputFormat (IIFE-style global assignment) is rejected for the named target. Parcel only supports `global` for the `browser`-style/UMD-like scenarios tied to specific targets, and this guard fires when descriptor.outputFormat === 'global' is set on a target whose configuration disallows it (paired with a code highlight on /targets/<name>/outputFormat).","triggerScenarios":"Setting `\"outputFormat\": \"global\"` under `targets.<name>` in package.json for a target that does not permit the global format (e.g. an esmodule/commonjs-only target).","commonSituations":"Migrating from webpack `libraryTarget: 'global'` and carrying the format over; trying to ship a UMD-ish bundle by hand-configuring global on a target that resolves to a non-browser context.","solutions":["Switch the target's outputFormat to a supported value (`esmodule`, `commonjs`) or use a target/context that supports `global`.","If you need a UMD/global browser bundle, ensure the target's env context is browser and remove conflicting options.","Remove the explicit outputFormat and let Parcel infer it from the target name/extension."],"exampleFix":"// before (package.json)\n\"targets\": {\n  \"main\": { \"outputFormat\": \"global\" }\n}\n\n// after\n\"targets\": {\n  \"main\": { \"outputFormat\": \"commonjs\" }\n}","handlingStrategy":"validation","validationCode":"function assertOutputFormat(targetName, descriptor) {\n  if (descriptor.outputFormat === 'global' && !/browser|umd/.test(targetName)) {\n    throw new Error(`\"global\" outputFormat not permitted for target ${targetName}`);\n  }\n}","typeGuard":"function allowsGlobalOutputFormat(descriptor) {\n  return descriptor?.outputFormat !== 'global' || descriptor?.context === 'browser';\n}","tryCatchPattern":"try { await parcel.run(); } catch (e) {\n  if (/\"global\" output format is not supported/.test(e.message)) {\n    console.error('Switch outputFormat to esmodule/commonjs or use a browser target.');\n  } else throw e;\n}","preventionTips":["Avoid `outputFormat: 'global'` on Node/library targets.","Use the `module` target for ESM and `main` for CJS instead of forcing global.","Document which targets permit global format in shared config."],"tags":["parcel","targets","output-format","global","config"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}