{"record":{"id":"3d842ac86ae6161d","repo":"vuejs/core","slug":"found-the-following-treeshaking-errors-n-n-err","errorCode":null,"errorMessage":"Found the following treeshaking errors:\\n\\n- ${errors.join('\\n\\n- ')}","messagePattern":"Found the following treeshaking errors:\\\\n\\\\n- (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/verify-treeshaking.js","lineNumber":45,"sourceCode":"    errors.push(\n      'prod build contains unexpected warning-related code.\\n' +\n        'This means there are calls of warn() that are not guarded by the __DEV__ condition.',\n    )\n  }\n\n  if (\n    prodBuild.includes('html,body,base') ||\n    prodBuild.includes('svg,animate,animateMotion') ||\n    prodBuild.includes('annotation,annotation-xml,maction')\n  ) {\n    errors.push(\n      'prod build contains unexpected domTagConfig lists.\\n' +\n        'This means helpers like isHTMLTag() is used in runtime code paths when it should be compiler-only.',\n    )\n  }\n\n  if (errors.length) {\n    throw new Error(\n      `Found the following treeshaking errors:\\n\\n- ${errors.join('\\n\\n- ')}`,\n    )\n  }\n})\n","sourceCodeStart":27,"sourceCodeEnd":50,"githubUrl":"https://github.com/vuejs/core/blob/a2b40db9a83b36ed9da3a16403cf8f040262d73f/scripts/verify-treeshaking.js#L27-L50","documentation":"Thrown by scripts/verify-treeshaking.js, a CI guard for Vue's bundle output. It inspects the production build artifact for code that should have been tree-shaken away (e.g. isHTMLTag / domTagConfig lists appearing in runtime code paths). When the accumulated `errors` array is non-empty, line 45 lists every violation. This is build/CI tooling, not user runtime code.","triggerScenarios":"A change to @vue/compiler-core or @vue/shared causes compiler-only helpers (like the domTagConfig arrays referenced at the top of the guard) to leak into the runtime production bundle. Running the verify-treeshaking CI job after such a change.","commonSituations":"Refactoring that makes runtime code import a compiler-only utility; side-effectful imports pulling in tag-config tables; bundler config changes weakening tree-shaking; adding a new DOM-tag helper used from runtime.","solutions":["Ensure compiler-only helpers (isHTMLTag, SVG tags, domTagConfig) are not imported from runtime packages — keep them in @vue/compiler-core / @vue/shared compiler entry points.","Mark compiler-only modules with sideEffects:false and split entries so rollup can drop them from runtime bundles.","Guard any runtime-sensitive import with a build flag so it is excluded from the runtime build.","Re-run the verify-treeshaking job locally and fix each error message in the list before pushing."],"exampleFix":"// before — runtime file imports a compiler-only helper\nimport { isHTMLTag } from '@vue/compiler-core'\n\n// after — gate it behind the compiler build only\n// (remove the import; resolve tag names at compile time and emit literals)","handlingStrategy":"validation","validationCode":"// (Vue build/CI) keep compiler-only helpers out of runtime bundles.\n// In rollup config, mark compiler-only modules side-effect free and split them:\nexport default {\n  treeshake: { moduleSideEffects: false },\n  // ensure @vue/compiler-core helpers are only imported by compiler entries\n}","typeGuard":"function runtimeBundleIsClean(prodBuildSource: string): boolean {\n  return !prodBuildSource.includes('isHTMLTag')\n    && !prodBuildSource.includes('svg,animate,animateMotion')\n    && !prodBuildSource.includes('annotation,annotation-xml,maction')\n}","tryCatchPattern":null,"preventionTips":["Keep DOM-tag helpers (isHTMLTag, domTagConfig) in compiler-only entries, not runtime packages.","Run the verify-treeshaking job locally before pushing changes that touch @vue/compiler-core or @vue/shared.","Guard compiler-only imports behind build flags so they drop out of the runtime bundle."],"tags":["vue","build-tooling","tree-shaking","ci","bundle-size","internal-scripts"],"backgroundTag":null,"analyzedSha":"a2b40db9a83b36ed9da3a16403cf8f040262d73f","analyzedAt":"2026-08-12T14:21:14.989Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}