{"record":{"id":"dac0e01664fd2a9b","repo":"quasarframework/quasar","slug":"extendpackagejson-extpkg-is-a-folder-inst","errorCode":null,"errorMessage":"extendPackageJson() - \"${extPkg}\" is a folder instead of file. Skipping...","messagePattern":"extendPackageJson\\(\\) - \"(.+?)\" is a folder instead of file\\. Skipping\\.\\.\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"app-vite/lib/app-extension/api-classes/InstallAPI.js","lineNumber":152,"sourceCode":"   * If specifying existing props, it will override them.\n   *\n   * @param {object|string} extPkg - Object to extend with or relative path to a JSON file\n   */\n  extendPackageJson(extPkg) {\n    if (!extPkg) return\n\n    if (typeof extPkg === 'string') {\n      const dir = getCallerPath(1)\n      const source = path.resolve(dir, extPkg)\n\n      if (!fs.existsSync(source)) {\n        this.logger.warn(\n          `extendPackageJson() - cannot locate ${extPkg}. Skipping...`\n        )\n        return\n      }\n      if (fs.lstatSync(source).isDirectory()) {\n        this.logger.warn(\n          `extendPackageJson() - \"${extPkg}\" is a folder instead of file. Skipping...`\n        )\n        return\n      }\n\n      try {\n        extPkg = JSON.parse(fs.readFileSync(source, 'utf8'))\n      } catch {\n        this.logger.warn(\n          `extendPackageJson() - \"${extPkg}\" is malformed. Exiting...`\n        )\n        warn()\n        process.exit(1)\n      }\n    }\n\n    if (Object(extPkg) !== extPkg || Object.keys(extPkg).length === 0) return\n","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/quasarframework/quasar/blob/4841521b5f635a971eb9e2710e5542efd194691b/app-vite/lib/app-extension/api-classes/InstallAPI.js#L134-L170","documentation":"extendPackageJson() resolves its string argument to a file; if fs.lstatSync reports the path is a directory, it warns and skips the merge. A folder cannot be parsed as a JSON fragment, so the extension's package.json additions are not applied.","triggerScenarios":"Calling api.extendPackageJson('./some-folder') where the argument points to a directory instead of a .json file.","commonSituations":"Passing the extension root folder by mistake; a path without extension where both file.json and a directory exist and the directory wins; refactoring that moved the JSON into a folder but kept passing the old-style path.","solutions":["Point extendPackageJson at the actual JSON file, not its folder","Verify the path with fs.statSync(...).isFile() during development","Pass a function to extendPackageJson to avoid file path resolution entirely"],"exampleFix":"// before\napi.extendPackageJson('./')\n// after\napi.extendPackageJson('./package-ext.json')","handlingStrategy":"validation","validationCode":"const fs = require('fs')\nconst stat = fs.statSync(source)\nif (!stat.isFile()) {\n  throw new Error(`extendPackageJson expects a file, got a ${stat.isDirectory() ? 'directory' : 'other'}: ${source}`)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass an explicit .json filename, never a directory path","Verify with fs.statSync(...).isFile() when building paths dynamically","Keep JSON fragments adjacent to index.js with unambiguous names"],"tags":["app-extension","install","package-json","path-type"],"backgroundTag":"expected-file-got-directory","analyzedSha":"4841521b5f635a971eb9e2710e5542efd194691b","analyzedAt":"2026-08-30T01:13:14.944Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}