{"record":{"id":"05107906ddd3de9e","repo":"react/create-react-app","slug":"preset-react-app-name-option-must-be-a-boole-051079","errorCode":null,"errorMessage":"Preset react-app: '${name}' option must be a boolean.","messagePattern":"Preset react-app: '(.+?)' option must be a boolean\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/babel-preset-react-app/dependencies.js","lineNumber":17,"sourceCode":"/**\n * Copyright (c) 2015-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';\n\nconst path = require('path');\n\nconst validateBoolOption = (name, value, defaultValue) => {\n  if (typeof value === 'undefined') {\n    value = defaultValue;\n  }\n\n  if (typeof value !== 'boolean') {\n    throw new Error(`Preset react-app: '${name}' option must be a boolean.`);\n  }\n\n  return value;\n};\n\nmodule.exports = function (api, opts) {\n  if (!opts) {\n    opts = {};\n  }\n\n  // This is similar to how `env` works in Babel:\n  // https://babeljs.io/docs/usage/babelrc/#env-option\n  // We are not using `env` because it’s ignored in versions > babel-core@6.10.4:\n  // https://github.com/babel/babel/issues/4539\n  // https://github.com/facebook/create-react-app/issues/720\n  // It’s also nice that we can enforce `NODE_ENV` being specified.\n  var env = process.env.BABEL_ENV || process.env.NODE_ENV;\n  var isEnvDevelopment = env === 'development';","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/babel-preset-react-app/dependencies.js#L1-L35","documentation":"dependencies.js ships an identical validateBoolOption helper to create.js. The preset's dependencies entry-point validates its own boolean options the same way and rejects any defined option whose type is not boolean. The two files keep separate copies so the dependencies path can be required standalone.","triggerScenarios":"Requiring babel-preset-react-app/dependencies directly (e.g. for a dependencies-only Babel pass) with an options object containing a non-boolean value for one of its toggles. Same `typeof value !== 'boolean'` check after undefined is defaulted.","commonSituations":"Tooling that compiles package dependencies separately passes the same options block used for the main preset, which may include keys meaningful only to create.js or values typed as strings. Sharing one config object across both entry points.","solutions":["Pass a dedicated, minimal options object to the dependencies entry containing only boolean-typed toggles.","Coerce any env-sourced flag with Boolean(...) or an === 'true' comparison before handing it over.","Drop keys you don't intend to override so the preset applies its defaults (undefined is allowed).","Audit the shared config helper that builds options for both create.js and dependencies.js and split per-entry defaults."],"exampleFix":"// before\nconst opts = { absoluteRuntime: process.env.ABS_RUNTIME, development: 'true' };\nrequire('babel-preset-react-app/dependencies')(api, opts);\n// after\nconst opts = { absoluteRuntime: Boolean(process.env.ABS_RUNTIME), development: true };\nrequire('babel-preset-react-app/dependencies')(api, opts);","handlingStrategy":"validation","validationCode":"// Build a dependencies-only options object with strict typing.\nfunction buildDepsOpts(raw = {}) {\n  const allowed = ['absoluteRuntime', 'development', 'runtime'];\n  const out = {};\n  for (const k of allowed) {\n    if (raw[k] !== undefined) {\n      if (typeof raw[k] !== 'boolean') {\n        throw new TypeError(`dependencies opts: '${k}' must be boolean`);\n      }\n      out[k] = raw[k];\n    }\n  }\n  return out;\n}\nrequire('babel-preset-react-app/dependencies')(api, buildDepsOpts(input));","typeGuard":"const isStrictBoolOpts = (o) =>\n  Object.keys(o || {}).every((k) => typeof o[k] === 'boolean');","tryCatchPattern":"try {\n  require('babel-preset-react-app/dependencies')(api, opts);\n} catch (e) {\n  if (/option must be a boolean/.test(e.message)) {\n    console.error('Dependencies preset got a non-boolean option:', opts);\n  }\n  throw e;\n}","preventionTips":["Keep separate option builders for create.js vs dependencies.js entries.","Coerce env-sourced flags with Boolean(...) before passing.","Don't reuse the main preset's options object blindly for the dependencies pass.","Document the allowed boolean keys next to the require call."],"tags":["babel","config","boolean","preset","dependencies","validation"],"backgroundTag":null,"analyzedSha":"6254386531d263688ccfa542d0e628fbc0de0b28","analyzedAt":"2026-08-12T22:55:01.751Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}