{"id":"622c2d5d81f3f09c","repo":"webpack/webpack","slug":"id-was-renamed-to-ids-and-type-changed-to-string-622c2d","errorCode":null,"errorMessage":"id was renamed to ids and type changed to string[]","messagePattern":"id was renamed to ids and type changed to string\\[\\]","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/dependencies/HarmonyImportSpecifierDependency.js","lineNumber":118,"sourceCode":"\t\t/** @type {undefined | boolean | string} */\n\t\tthis.shorthand = undefined;\n\t\t/** @type {undefined | boolean} */\n\t\tthis.asiSafe = undefined;\n\t\t/** @type {UsedByExports | undefined} */\n\t\tthis.usedByExports = undefined;\n\t\t/** @type {DestructuringAssignmentProperties | undefined} */\n\t\tthis.referencedPropertiesInDestructuring = undefined;\n\t\t/** @type {DependencyGuard[] | undefined} */\n\t\tthis.branchGuards = undefined;\n\t}\n\n\t// TODO webpack 6 remove\n\t/**\n\t * Returns id.\n\t * @deprecated\n\t */\n\tget id() {\n\t\tthrow new Error(\"id was renamed to ids and type changed to string[]\");\n\t}\n\n\t// TODO webpack 6 remove\n\t/**\n\t * Returns id.\n\t * @deprecated\n\t */\n\tgetId() {\n\t\tthrow new Error(\"id was renamed to ids and type changed to string[]\");\n\t}\n\n\t// TODO webpack 6 remove\n\t/**\n\t * Updates id.\n\t * @deprecated\n\t */\n\tsetId() {\n\t\tthrow new Error(\"id was renamed to ids and type changed to string[]\");","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/webpack/webpack/blob/318421ea8ac81371f5171236a6efb63675576528/lib/dependencies/HarmonyImportSpecifierDependency.js#L100-L136","documentation":"HarmonyImportSpecifierDependency.id was a single-string property that webpack replaced with the ids array (string[]) to support nested/member export specifiers. The getter is kept only as a deprecation guard (marked TODO webpack 6 remove) and throws unconditionally to surface old API usage. Accessing .id means the calling code predates the multi-id refactor and will produce wrong results even if it returned.","triggerScenarios":"A custom plugin, loader, or webpack-internals fork reads dependency.id on a harmony import specifier dependency produced by the ES module parser. Also triggered by third-party tooling (bundle analyzers, instrumentation) that walks the dependency graph using the pre-5.x field name.","commonSituations":"Upgrading webpack major version while a plugin has not been updated; a private fork of webpack that still references id; static-analysis tooling built against an older webpack types.d.ts.","solutions":["Replace dependency.id with dependency.ids (string[]) and adjust consuming code to handle the array.","Use dependency.getIds(moduleGraph) when you need the resolved ids (it accounts for module-graph rewrites).","Upgrade or replace the third-party plugin that still references the old .id API."],"exampleFix":"// before\nconst name = dep.id;\n// after\nconst names = dep.ids;\nconst resolved = dep.getIds(moduleGraph);","handlingStrategy":"type-guard","validationCode":"if (dep instanceof HarmonyImportSpecifierDependency && !('id' in HarmonyImportSpecifierDependency.prototype && Object.getOwnPropertyDescriptor(HarmonyImportSpecifierDependency.prototype, 'id').get)) {\n  // safe: id is gone; use ids\n}\n// simpler: lint for `.id` on harmony specifier deps","typeGuard":"/** @param {object} dep @returns {dep is { ids: string[] }} */\nfunction hasIds(dep) {\n  return Array.isArray(dep.ids);\n}","tryCatchPattern":null,"preventionTips":["Upgrade plugins together with webpack; pin peerDependency ranges.","Lint plugin code for HarmonyImportSpecifierDependency.prototype.id usage.","Prefer getIds(moduleGraph) over direct field reads for resolved values."],"tags":["es-modules","deprecation","dependency-graph","api-migration"],"analyzedSha":"318421ea8ac81371f5171236a6efb63675576528","analyzedAt":"2026-08-03T19:39:56.731Z","schemaVersion":2}