[{"data":1,"prerenderedAt":496},["ShallowReactive",2],{"navigation_docs":3,"rule-content-\u002Fvite\u002Frules\u002Fplugin\u002Fno-config-hook-array-echo":48},[4,8,12,16,20,24,28,32,36,40,44],{"title":5,"path":6,"stem":7},"CLI","\u002Fcli","1.cli",{"title":9,"path":10,"stem":11},"Nuxt","\u002Fnuxt","2.nuxt",{"title":13,"path":14,"stem":15},"Vue","\u002Fvue","3.vue",{"title":17,"path":18,"stem":19},"Vite","\u002Fvite","4.vite",{"title":21,"path":22,"stem":23},"Nitro","\u002Fnitro","5.nitro",{"title":25,"path":26,"stem":27},"TypeScript","\u002Ftypescript","6.typescript",{"title":29,"path":30,"stem":31},"shadcn","\u002Fshadcn","7.shadcn",{"title":33,"path":34,"stem":35},"Package","\u002Fpackage","8.package",{"title":37,"path":38,"stem":39},"Extending Doctor","\u002Fextending","9.extending",{"title":41,"path":42,"stem":43},"MCP","\u002Fmcp","9.mcp",{"title":45,"path":46,"stem":47},"Pinia","\u002Fpinia","9.pinia",{"id":49,"title":50,"body":51,"category":57,"description":484,"diagnosticCodes":485,"docsUrl":59,"extension":486,"fix":60,"framework":487,"meta":488,"navigation":489,"pack":61,"path":491,"recommendedReplacement":127,"ruleId":62,"seo":492,"severity":63,"source":64,"sourceUrl":65,"stem":493,"why":494,"__hash__":495},"rules\u002Fvite\u002Frules\u002Fplugin\u002Fno-config-hook-array-echo.md","Return only new array entries from Vite config hooks",{"type":52,"value":53,"toc":475},"minimark",[54,66,71,109,113,121,125,128,132,151,155,160,163,335,338,471],[55,56],"rule-metadata",{"category":57,"diagnosticCodes":58,"docsUrl":59,"fix":60,"pack":61,"ruleId":62,"severity":63,"source":64,"sourceUrl":65},"plugins","VITE0026","https:\u002F\u002Fvite.dev\u002Fguide\u002Fapi-plugin.html#config","no","vite-doctor\u002Fvite","vite\u002Fplugin\u002Fno-config-hook-array-echo","warn","src\u002Frule-packs\u002Fvite\u002Frules\u002Fplugin-config.ts","https:\u002F\u002Fgithub.com\u002Fonmax\u002Fvite-doctor\u002Fblob\u002Fmain\u002Fsrc\u002Frule-packs\u002Fvite\u002Frules\u002Fplugin-config.ts",[67,68,70],"h2",{"id":69},"run-this-rule","Run this rule",[72,73,78],"pre",{"className":74,"code":75,"language":76,"meta":77,"style":77},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","pnpm vite-doctor . --framework vite --rules vite\u002Fplugin\u002Fno-config-hook-array-echo\n","bash","",[79,80,81],"code",{"__ignoreMap":77},[82,83,86,90,94,97,100,103,106],"span",{"class":84,"line":85},"line",1,[82,87,89],{"class":88},"sBMFI","pnpm",[82,91,93],{"class":92},"sfazB"," vite-doctor",[82,95,96],{"class":92}," .",[82,98,99],{"class":92}," --framework",[82,101,102],{"class":92}," vite",[82,104,105],{"class":92}," --rules",[82,107,108],{"class":92}," vite\u002Fplugin\u002Fno-config-hook-array-echo\n",[67,110,112],{"id":111},"why-it-matters","Why it matters",[114,115,116,117,120],"p",{},"Vite merges each config and configEnvironment hook result into the current config with mergeConfig, which concatenates arrays instead of replacing them. A hook that returns ",[82,118,119],{},"...config.ssr.noExternal, 'my-package'"," therefore adds every existing entry a second time, and each plugin that does this doubles the entries of the plugins before it. Doctor reports a returned array at a config path that spreads or concatenates the incoming value at the same path, directly or through a helper function defined once in the same file that returns its parameter spread or concatenated. It does not follow helpers imported from other files, and it ignores hooks that assign to the incoming config in place. An object counts as a plugin when it has Vite plugin hooks such as configResolved or enforce, or when it has a name and the file imports or requires Vite, Vitest, Rollup, Rolldown, unplugin, or @nuxt\u002Fkit, or is a Vite config.",[67,122,124],{"id":123},"recommended-fix","Recommended fix",[114,126,127],{},"Return only the entries the plugin adds, skipping entries that are already present, or assign to the incoming config in place and leave that field out of the returned object.",[67,129,131],{"id":130},"useful-links","Useful links",[133,134,135,144],"ul",{},[136,137,138],"li",{},[139,140,143],"a",{"href":59,"rel":141},[142],"nofollow","Rule reference",[136,145,146],{},[139,147,150],{"href":148,"rel":149},"https:\u002F\u002Fvite.dev\u002Fguide\u002Fapi-plugin",[142],"Vite plugin API",[67,152,154],{"id":153},"example","Example",[156,157,159],"h3",{"id":158},"return-only-the-added-entries","Return only the added entries",[114,161,162],{},"Before",[72,164,168],{"className":165,"code":166,"language":167,"meta":77,"style":77},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","export function dedupePlugin(): Plugin {\n  return {\n    name: 'dedupe-vue',\n    config(config) {\n      return {\n        resolve: { dedupe: [...(config.resolve?.dedupe ?? []), 'vue'] },\n      }\n    },\n  }\n}\n","ts",[79,169,170,194,202,224,242,250,311,317,323,329],{"__ignoreMap":77},[82,171,172,176,180,184,188,191],{"class":84,"line":85},[82,173,175],{"class":174},"s7zQu","export",[82,177,179],{"class":178},"spNyl"," function",[82,181,183],{"class":182},"s2Zo4"," dedupePlugin",[82,185,187],{"class":186},"sMK4o","():",[82,189,190],{"class":88}," Plugin",[82,192,193],{"class":186}," {\n",[82,195,197,200],{"class":84,"line":196},2,[82,198,199],{"class":174},"  return",[82,201,193],{"class":186},[82,203,205,209,212,215,218,221],{"class":84,"line":204},3,[82,206,208],{"class":207},"swJcz","    name",[82,210,211],{"class":186},":",[82,213,214],{"class":186}," '",[82,216,217],{"class":92},"dedupe-vue",[82,219,220],{"class":186},"'",[82,222,223],{"class":186},",\n",[82,225,227,230,233,237,240],{"class":84,"line":226},4,[82,228,229],{"class":207},"    config",[82,231,232],{"class":186},"(",[82,234,236],{"class":235},"sHdIc","config",[82,238,239],{"class":186},")",[82,241,193],{"class":186},[82,243,245,248],{"class":84,"line":244},5,[82,246,247],{"class":174},"      return",[82,249,193],{"class":186},[82,251,253,256,258,261,264,266,269,272,274,277,280,283,286,289,292,295,298,300,303,305,308],{"class":84,"line":252},6,[82,254,255],{"class":207},"        resolve",[82,257,211],{"class":186},[82,259,260],{"class":186}," {",[82,262,263],{"class":207}," dedupe",[82,265,211],{"class":186},[82,267,268],{"class":207}," [",[82,270,271],{"class":186},"...",[82,273,232],{"class":207},[82,275,236],{"class":276},"sTEyZ",[82,278,279],{"class":186},".",[82,281,282],{"class":276},"resolve",[82,284,285],{"class":186},"?.",[82,287,288],{"class":276},"dedupe",[82,290,291],{"class":186}," ??",[82,293,294],{"class":207}," [])",[82,296,297],{"class":186},",",[82,299,214],{"class":186},[82,301,302],{"class":92},"vue",[82,304,220],{"class":186},[82,306,307],{"class":207},"] ",[82,309,310],{"class":186},"},\n",[82,312,314],{"class":84,"line":313},7,[82,315,316],{"class":186},"      }\n",[82,318,320],{"class":84,"line":319},8,[82,321,322],{"class":186},"    },\n",[82,324,326],{"class":84,"line":325},9,[82,327,328],{"class":186},"  }\n",[82,330,332],{"class":84,"line":331},10,[82,333,334],{"class":186},"}\n",[114,336,337],{},"After",[72,339,341],{"className":165,"code":340,"language":167,"meta":77,"style":77},"export function dedupePlugin(): Plugin {\n  return {\n    name: 'dedupe-vue',\n    config(config) {\n      if (config.resolve?.dedupe?.includes('vue')) return\n      return { resolve: { dedupe: ['vue'] } }\n    },\n  }\n}\n",[79,342,343,357,363,377,389,426,459,463,467],{"__ignoreMap":77},[82,344,345,347,349,351,353,355],{"class":84,"line":85},[82,346,175],{"class":174},[82,348,179],{"class":178},[82,350,183],{"class":182},[82,352,187],{"class":186},[82,354,190],{"class":88},[82,356,193],{"class":186},[82,358,359,361],{"class":84,"line":196},[82,360,199],{"class":174},[82,362,193],{"class":186},[82,364,365,367,369,371,373,375],{"class":84,"line":204},[82,366,208],{"class":207},[82,368,211],{"class":186},[82,370,214],{"class":186},[82,372,217],{"class":92},[82,374,220],{"class":186},[82,376,223],{"class":186},[82,378,379,381,383,385,387],{"class":84,"line":226},[82,380,229],{"class":207},[82,382,232],{"class":186},[82,384,236],{"class":235},[82,386,239],{"class":186},[82,388,193],{"class":186},[82,390,391,394,397,399,401,403,405,407,409,412,414,416,418,420,423],{"class":84,"line":244},[82,392,393],{"class":174},"      if",[82,395,396],{"class":207}," (",[82,398,236],{"class":276},[82,400,279],{"class":186},[82,402,282],{"class":276},[82,404,285],{"class":186},[82,406,288],{"class":276},[82,408,285],{"class":186},[82,410,411],{"class":182},"includes",[82,413,232],{"class":207},[82,415,220],{"class":186},[82,417,302],{"class":92},[82,419,220],{"class":186},[82,421,422],{"class":207},")) ",[82,424,425],{"class":174},"return\n",[82,427,428,430,432,435,437,439,441,443,445,447,449,451,453,456],{"class":84,"line":252},[82,429,247],{"class":174},[82,431,260],{"class":186},[82,433,434],{"class":207}," resolve",[82,436,211],{"class":186},[82,438,260],{"class":186},[82,440,263],{"class":207},[82,442,211],{"class":186},[82,444,268],{"class":207},[82,446,220],{"class":186},[82,448,302],{"class":92},[82,450,220],{"class":186},[82,452,307],{"class":207},[82,454,455],{"class":186},"}",[82,457,458],{"class":186}," }\n",[82,460,461],{"class":84,"line":313},[82,462,322],{"class":186},[82,464,465],{"class":84,"line":319},[82,466,328],{"class":186},[82,468,469],{"class":84,"line":325},[82,470,334],{"class":186},[472,473,474],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}",{"title":77,"searchDepth":196,"depth":196,"links":476},[477,478,479,480,481],{"id":69,"depth":196,"text":70},{"id":111,"depth":196,"text":112},{"id":123,"depth":196,"text":124},{"id":130,"depth":196,"text":131},{"id":153,"depth":196,"text":154,"children":482},[483],{"id":158,"depth":204,"text":159},"Reports Vite config and configEnvironment hooks that return arrays containing the incoming config's entries.",[58],"md","vite",{},{"title":490},"Config hook arrays","\u002Fvite\u002Frules\u002Fplugin\u002Fno-config-hook-array-echo",{"title":50,"description":484},"vite\u002Frules\u002Fplugin\u002Fno-config-hook-array-echo","Vite merges each config and configEnvironment hook result into the current config with mergeConfig, which concatenates arrays instead of replacing them. A hook that returns [...config.ssr.noExternal, 'my-package'] therefore adds every existing entry a second time, and each plugin that does this doubles the entries of the plugins before it. Doctor reports a returned array at a config path that spreads or concatenates the incoming value at the same path, directly or through a helper function defined once in the same file that returns its parameter spread or concatenated. It does not follow helpers imported from other files, and it ignores hooks that assign to the incoming config in place. An object counts as a plugin when it has Vite plugin hooks such as configResolved or enforce, or when it has a name and the file imports or requires Vite, Vitest, Rollup, Rolldown, unplugin, or @nuxt\u002Fkit, or is a Vite config.","StBhAq8Ty8X-ll5CJtmb4lUA6_GjM8YcVolhZzI6ibI",1795268791716]