{"record":{"id":"04bb7146fc23734a","repo":"parcel-bundler/parcel","slug":"unknown-environment-feature-feature","errorCode":null,"errorMessage":"Unknown environment feature: ${feature}","messagePattern":"Unknown environment feature: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/core/src/public/Environment.js","lineNumber":313,"sourceCode":"      }\n\n      let minBrowsers = getExcludedBrowsers(minVersions);\n      let withoutMinBrowsers = browserslist([...browsers, ...minBrowsers]);\n      return matchedBrowsers.length === withoutMinBrowsers.length;\n    } else if (this.isNode() && this.engines.node != null) {\n      return (\n        minVersions.node != null &&\n        !semver.intersects(`< ${minVersions.node}`, this.engines.node)\n      );\n    }\n\n    return defaultValue;\n  }\n\n  supports(feature: EnvironmentFeature, defaultValue?: boolean): boolean {\n    let engines = supportData[feature];\n    if (!engines) {\n      throw new Error('Unknown environment feature: ' + feature);\n    }\n\n    return this.matchesEngines(engines, defaultValue);\n  }\n}\n\nfunction getExcludedBrowsers(minVersions: VersionMap) {\n  let browsers = [];\n  for (let browser of ALL_BROWSERS) {\n    let version = minVersions[browser];\n    if (version) {\n      browsers.push(`not ${browser} < ${version}`);\n    } else {\n      browsers.push(`not ${browser} > 0`);\n    }\n  }\n\n  return browsers;","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/core/core/src/public/Environment.js#L295-L331","documentation":"`Environment.supports(feature)` looks up the feature in a static `supportData` table keyed by known `EnvironmentFeature` values (`esmodules`, `dynamic-import`, `worker-module`, `service-worker-module`, `import-meta-url`, `import-meta-resolve`, `arrow-functions`, `global-this`). If the key is absent, the feature name is unknown and the call is a programming error rather than a feature-gating question.","triggerScenarios":"Calling `env.supports('some-feature')` with a string not in the EnvironmentFeature union (typo, deprecated, or future feature).","commonSituations":"Typos in feature names; relying on a feature added in a newer Parcel while running an older version; passing a user-defined string.","solutions":["Use one of the documented EnvironmentFeature string literals exactly.","Upgrade Parcel if you need a feature that exists in a newer version.","If unsure, enumerate `Object.keys(supportData)`-equivalent constants instead of hardcoding strings."],"exampleFix":"// before\nif (env.supports('es-module')) { ... } // typo\n\n// after\nif (env.supports('esmodules')) { ... }","handlingStrategy":"type-guard","validationCode":"// Restrict calls to the known feature set.\nconst KNOWN = new Set([\n  'esmodules','dynamic-import','worker-module','service-worker-module',\n  'import-meta-url','import-meta-resolve','arrow-functions','global-this',\n]);\nif (!KNOWN.has(feature)) throw new Error(`unknown feature: ${feature}`);\nconst ok = env.supports(feature);","typeGuard":"function isKnownFeature(f: string): boolean {\n  return new Set([\n    'esmodules','dynamic-import','worker-module','service-worker-module',\n    'import-meta-url','import-meta-resolve','arrow-functions','global-this',\n  ]).has(f);\n}","tryCatchPattern":null,"preventionTips":["Use the EnvironmentFeature string literals, never ad-hoc strings.","Upgrade Parcel if you need a newer feature.","Wrap supports() in a helper that validates the feature name first."],"tags":["environment","feature-flag","api"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}