{"id":116644,"date":"2026-10-21T23:49:18","date_gmt":"2026-10-21T15:49:18","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/116644.html"},"modified":"2026-10-21T23:49:18","modified_gmt":"2026-10-21T15:49:18","slug":"vite%e6%80%a7%e8%83%bd%e4%bc%98%e5%8c%96%e5%ae%8c%e5%85%a8%e6%8c%87%e5%8d%97","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/116644.html","title":{"rendered":"Vite\u6027\u80fd\u4f18\u5316\u5b8c\u5168\u6307\u5357"},"content":{"rendered":"<p>                    <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261021154917-6ad8defd12802.png\" alt=\"\u5c01\u9762\" \/><\/p>\n<p>&#034;\u4e3a\u4ec0\u4e48\u7528\u4e86Vite&#xff0c;\u9996\u5c4f\u8fd8\u662f\u6162&#xff1f;&#034;\u53bb\u5e74\u63a5\u624b\u4e00\u4e2a\u4e2d\u53f0\u9879\u76ee\u65f6&#xff0c;\u6211\u76ef\u7740Chrome DevTools\u91cc\u957f\u8fbe3\u79d2\u7684LCP\u6307\u6807&#xff0c;\u53d1\u73b0Vite\u7684&#034;\u95ea\u7535\u822c&#034;\u5f00\u53d1\u4f53\u9a8c\u5e76\u6ca1\u6709\u81ea\u52a8\u8f6c\u5316\u4e3a\u751f\u4ea7\u6027\u80fd\u3002\u7ecf\u8fc7\u4e24\u5468\u7684\u6df1\u5ea6\u8c03\u4f18&#xff0c;\u6700\u7ec8\u5c06LCP\u4ece3s\u538b\u5230800ms\u3002\u672c\u6587\u5c06\u5206\u4eab\u90a3\u4e9b\u4e0d\u4f1a\u51fa\u73b0\u5728\u5b98\u65b9\u6587\u6863\u91cc\u7684\u786c\u6838\u4f18\u5316\u624b\u6bb5\u3002<\/p>\n<h3>1. \u9884\u6784\u5efa&#xff1a;\u88ab\u5ffd\u89c6\u7684\u6027\u80fd\u9ed1\u6d1e  <\/h3>\n<p>\u63a5\u624b\u7684\u662f\u4e00\u4e2a\u57fa\u4e8eVue 3 &#043; Vite\u7684\u7269\u6d41\u7ba1\u7406\u540e\u53f0&#xff0c;\u5f53\u4f9d\u8d56\u9879\u589e\u957f\u5230150&#043;\u65f6&#xff0c;\u51b7\u542f\u52a8\u65f6\u95f4\u4ece1.5\u79d2\u66b4\u6da8\u52308\u79d2\u3002\u95ee\u9898\u51fa\u5728\u975e\u667a\u80fd\u7684\u9884\u6784\u5efa\u7b56\u7565&#xff1a;<\/p>\n<p># \u9519\u8bef\u505a\u6cd5&#xff1a;\u5b8c\u5168\u4f9d\u8d56\u81ea\u52a8\u53d1\u73b0<br \/>\n# vite.config.js<br \/>\nexport default {<br \/>\n  optimizeDeps: {<br \/>\n    auto: true \/\/ \u9ed8\u8ba4\u503c&#xff0c;\u53ef\u80fd\u6f0f\u6389\u6df1\u5c42\u4f9d\u8d56<br \/>\n  }<br \/>\n}<\/p>\n<p>Vite\u7684\u9884\u6784\u5efa\u673a\u5236\u662f&#xff1a;\u9996\u6b21\u542f\u52a8\u65f6\u626b\u63cf\u5165\u53e3\u6587\u4ef6\u7684import\u8bed\u53e5&#xff0c;\u5c06CommonJS\/UMD\u683c\u5f0f\u7684\u4f9d\u8d56\u8f6c\u6362\u4e3aESM\u3002\u4f46\u5b9e\u9645\u9879\u76ee\u4e2d&#xff1a;<\/p>\n<li>\u52a8\u6001\u5bfc\u5165&#xff08;\u5982import(&#039;lib\/&#039; &#043; variable)&#xff09;\u65e0\u6cd5\u88ab\u9759\u6001\u5206\u6790<\/li>\n<li>\u6df1\u5c42\u5d4c\u5957\u7684\u4f9d\u8d56&#xff08;\u5982A\u2192B\u2192C\u4e2dB\u662fESM\u4f46C\u662fCJS&#xff09;\u53ef\u80fd\u88ab\u9057\u6f0f<\/li>\n<li>\u672a\u4f7f\u7528\u7684\u4f9d\u8d56\u4e5f\u88ab\u6253\u5305&#xff08;\u5982\u7ec4\u4ef6\u5e93\u7684\u5168\u91cf\u5f15\u5165&#xff09;<\/li>\n<ul>\n<li>\u4f18\u5316\u65b9\u6848&#xff1a;<\/li>\n<\/ul>\n<p>\/\/ vite.config.js<br \/>\nexport default {<br \/>\n  optimizeDeps: {<br \/>\n    include: [  \/\/ \u663e\u5f0f\u58f0\u660e\u9700\u8981\u9884\u6784\u5efa\u7684\u4f9d\u8d56<br \/>\n      &#039;vue&#039;,<br \/>\n      &#039;lodash-es&#039;,<br \/>\n      &#039;element-plus\/es\/components\/table&#039;,<br \/>\n      &#039;axios&#039;<br \/>\n    ],<br \/>\n    exclude: [&#039;debug&#039;], \/\/ \u6392\u9664\u5f00\u53d1\u4e13\u7528\u5305<br \/>\n    force: true \/\/ \u9996\u6b21\u542f\u52a8\u5f3a\u5236\u91cd\u5efa<br \/>\n  }<br \/>\n}<\/p>\n<p>\u5bf9\u6bd4\u6570\u636e&#xff1a;<\/p>\n<ul>\n<li>\u4f18\u5316\u524d&#xff1a;8\u79d2&#xff08;\u81ea\u52a8\u53d1\u73b0\u6f0f\u638932\u4e2a\u4f9d\u8d56&#xff09;<\/li>\n<li>\u4f18\u5316\u540e&#xff1a;2.1\u79d2&#xff08;\u5168\u91cf\u9884\u6784\u5efa&#043;\u6392\u9664\u5e72\u6270\u9879&#xff09;<\/li>\n<li>\u907f\u5751\u6e05\u5355&#xff1a;<\/li>\n<li>\u4e0d\u8981\u4f9d\u8d56auto: true\u5904\u7406Monorepo\u9879\u76ee<\/li>\n<ul>\n<li>node_modules\/.vite\u7f13\u5b58\u76ee\u5f55\u9700\u8981\u968f\u4f9d\u8d56\u7248\u672c\u66f4\u65b0\u800c\u6e05\u9664<\/li>\n<li>\u52a8\u6001\u8def\u5f84\u5f15\u7528\u7684\u5305&#xff08;\u5982import(&#039;&#064;libs\/&#039; &#043; name)&#xff09;\u9700\u624b\u52a8\u58f0\u660e<\/li>\n<li>\u7ec4\u4ef6\u5e93\u6309\u9700\u5f15\u5165\u65f6&#xff0c;\u5fc5\u987b\u5305\u542b\u6240\u6709\u7528\u5230\u7684\u5b50\u7ec4\u4ef6\u8def\u5f84<\/li>\n<\/ul>\n<h3>2. \u5206\u7247\u7b56\u7565&#xff1a;\u62c6\u5305\u7684\u827a\u672f  <\/h3>\n<p>\u5f53\u4ea7\u7269\u8d85\u8fc720\u4e2achunk\u65f6&#xff0c;\u6211\u4eec\u9047\u5230\u4e86\u9996\u6b21\u52a0\u8f7d\u65f6\u5927\u91cf\u5c0f\u6587\u4ef6\u8bf7\u6c42\u7684\u95ee\u9898\u3002\u5173\u952e\u53d1\u73b0&#xff1a;<\/p>\n<li>Vite\u9ed8\u8ba4\u7684manualChunks\u53ef\u80fd\u8ba9\u4f60\u7684HTTP\/2\u4f18\u52bf\u53d8\u52a3\u52bf\u3002\n<p>\u5178\u578b\u53cd\u6a21\u5f0f&#xff1a;<\/p>\n<p>\/\/ \u9519\u8bef\u7684\u5206\u7247\u65b9\u5f0f<br \/>\nrollupOptions: {<br \/>\n  output: {<br \/>\n    manualChunks: {<br \/>\n      vendor: [&#039;vue&#039;, &#039;vue-router&#039;],<br \/>\n      utils: [&#039;lodash&#039;, &#039;axios&#039;]<br \/>\n    }<br \/>\n  }<br \/>\n}<\/p>\n<p>\u5728HTTP\/2\u73af\u5883\u4e0b&#xff0c;\u8fd9\u79cd&#034;\u6309\u7c7b\u578b\u5206\u7247&#034;\u4f1a\u5bfc\u81f4&#xff1a;<\/p>\n<ul>\n<li>\u5e76\u884c\u8bf7\u6c42\u8fc7\u591a&#xff08;Chrome\u540c\u4e00\u57df\u540d\u4e0b\u6700\u591a6\u4e2aTCP\u8fde\u63a5&#xff09;<\/li>\n<li>\u7f13\u5b58\u5229\u7528\u7387\u4f4e&#xff08;utils\u7684\u53d8\u66f4\u4f7fvendor\u7f13\u5b58\u5931\u6548&#xff09;<\/li>\n<li>\u4f18\u5316\u540e\u7684\u5206\u7247\u7b56\u7565&#xff1a;<\/li>\n<\/ul>\n<p>function createCustomChunk(id) {<br \/>\n  if (id.includes(&#039;node_modules&#039;)) {<br \/>\n    const pkg &#061; id.split(&#039;node_modules\/&#039;)[1].split(&#039;\/&#039;)[0]<br \/>\n    if (pkg.includes(&#039;element-plus&#039;)) return &#039;ui&#039;<br \/>\n    return &#039;vendor&#039;<br \/>\n  }<br \/>\n  if (id.includes(&#039;src\/components&#039;)) return &#039;components&#039;<br \/>\n}<br \/>\nexport default {<br \/>\n  build: {<br \/>\n    rollupOptions: {<br \/>\n      output: {<br \/>\n        manualChunks: createCustomChunk<br \/>\n      }<br \/>\n    }<br \/>\n  }<br \/>\n}<\/p>\n<p>\u5173\u952e\u539f\u5219&#xff1a;<\/p>\n<ul>\n<li>\u540c\u5305\u540cchunk&#xff08;\u5982\u6240\u6709element-plus\u7ec4\u4ef6\u6253\u5305\u5230ui)<\/li>\n<li>\u4e1a\u52a1\u7ec4\u4ef6\u5355\u72ec\u5206\u7247&#xff08;\u6309\u8def\u7531\u6216\u529f\u80fd&#xff09;<\/li>\n<li>\u57fa\u7840\u5e93\u4fdd\u6301\u7a33\u5b9a&#xff08;vendor\u5355\u72ec\u5206\u7247&#xff09;<\/li>\n<\/ul>\n<p>\u5b9e\u6d4b\u6548\u679c&#xff1a;<\/p>\n<table>\n<tr>\u7b56\u7565\u8bf7\u6c42\u6570\u7f13\u5b58\u547d\u4e2d\u7387<\/tr>\n<tbody>\n<tr>\n<td>\u9ed8\u8ba4<\/td>\n<td>28<\/td>\n<td>62%<\/td>\n<\/tr>\n<tr>\n<td>\u4f18\u5316\u540e<\/td>\n<td>14<\/td>\n<td>89%<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>3. \u6309\u9700\u52a0\u8f7d&#xff1a;\u52a8\u6001\u5bfc\u5165\u7684\u9677\u9631  <\/h3>\n<p>\u5728\u5f02\u6b65\u52a0\u8f7d\u5bcc\u6587\u672c\u7f16\u8f91\u5668\u7684\u573a\u666f\u4e2d&#xff0c;\u6211\u4eec\u9047\u5230\u4e86\u4ee4\u4eba\u56f0\u60d1\u7684\u73b0\u8c61&#xff1a;\u660e\u660e\u7528import()\u505a\u4e86\u4ee3\u7801\u5206\u5272&#xff0c;\u4f46\u6784\u5efa\u540e\u7684HTML\u91cc\u4f9d\u7136\u51fa\u73b0\u4e86\u9884\u52a0\u8f7d\u6807\u7b7e&#xff1a;<\/p>\n<p>&lt;!&#8211; \u610f\u5916\u7684\u9884\u52a0\u8f7d &#8211;&gt;<br \/>\n&lt;link rel&#061;&#034;modulepreload&#034; href&#061;&#034;\/src\/components\/Editor.vue&#034; \/&gt;<\/p>\n<ul>\n<li>\u6839\u56e0&#xff1a;Vite\u7684\u9ed8\u8ba4\u9884\u52a0\u8f7d\u7b56\u7565\u4f1a\u5206\u6790\u6240\u6709\u53ef\u80fd\u7684\u52a8\u6001\u5bfc\u5165\u8def\u5f84&#xff0c;\u5bf9\u786e\u5b9a\u6027\u8def\u5f84&#xff08;\u5982import(&#039;.\/Editor.vue&#039;)&#xff09;\u81ea\u52a8\u751f\u6210modulepreload\u3002\u8fd9\u5728SPA\u4e2d\u53cd\u800c\u4f1a\u62d6\u6162\u9996\u5c4f\u3002<\/li>\n<li>\u89e3\u51b3\u65b9\u6848&#xff1a;<\/li>\n<\/ul>\n<p>\/\/ \u6b63\u786e\u505a\u6cd5&#xff1a;\u5bf9\u975e\u9996\u5c4f\u8d44\u6e90\u5173\u95ed\u9884\u52a0\u8f7d<br \/>\nexport default {<br \/>\n  build: {<br \/>\n    rollupOptions: {<br \/>\n      output: {<br \/>\n   \u00a0\u00a0\u00a0\u00a0 experimentalMinChunkSize: 1024 * 10, \/\/ 10KB\u4ee5\u4e0b\u4e0d\u62c6\u5206<br \/>\n        manualChunks: (id) &#061;&gt; {<br \/>\n          if (id.includes(&#039;RichTextEditor&#039;)) {<br \/>\n            return &#039;editor&#039;<br \/>\n          }<br \/>\n        }<br \/>\n      }<br \/>\n    }<br \/>\n  }<br \/>\n}<\/p>\n<p>\u540c\u65f6\u914d\u5408\u8def\u7531\u7ea7\u61d2\u52a0\u8f7d&#xff1a;<\/p>\n<p>\/\/ router.js<br \/>\n{<br \/>\n  path: &#039;\/edit&#039;,<br \/>\n  component: () &#061;&gt; import(\/* webpackChunkName: &#034;editor&#034; *\/ &#039;.\/Editor.vue&#039;)<br \/>\n}<\/p>\n<ul>\n<li>\u5173\u952e\u6307\u6807\u5bf9\u6bd4&#xff1a;<\/li>\n<li>\u4f18\u5316\u524d&#xff1a;\u9996\u5c4f\u52a0\u8f7d1.8MB&#xff08;\u5305\u542b\u7f16\u8f91\u5668\u4ee3\u7801&#xff09;<\/li>\n<ul>\n<li>\u4f18\u5316\u540e&#xff1a;\u9996\u5c4f1.2MB&#xff0c;\u7f16\u8f91\u5668\u5ef6\u8fdf\u52a0\u8f7d<\/li>\n<\/ul>\n<h3>4. \u7ec8\u6781\u6b66\u5668&#xff1a;SSR-friendly\u4f18\u5316  <\/h3>\n<p>\u5f53\u9879\u76ee\u9700\u8981SSR\u65f6&#xff0c;\u76f4\u63a5\u4f7f\u7528vite build\u4f1a\u5bfc\u81f4\u6027\u80fd\u9000\u5316\u3002\u4ee5\u4e0b\u662f\u6211\u4eec\u5728\u540c\u6784\u6e32\u67d3\u4e2d\u53d1\u73b0\u7684\u4e09\u4e2a\u81f4\u547d\u95ee\u9898&#xff1a;<\/p>\n<li><\/li>\n<li>Client Hydration\u5931\u8d25&#xff1a;SSR\u751f\u6210\u7684DOM\u7ed3\u6784\u4e0e\u5ba2\u6237\u7aef\u4e0d\u5339\u914d<\/li>\n<li><\/li>\n<li>SSR\u6784\u5efa\u4ea7\u7269\u5197\u4f59&#xff1a;\u5305\u542b\u5ba2\u6237\u7aef\u4e13\u7528\u4ee3\u7801<\/li>\n<li><\/li>\n<li>\u5185\u5b58\u6cc4\u6f0f&#xff1a;createApp()\u672a\u6b63\u786e\u9500\u6bc1<\/li>\n<li>\n<ul>\n<li>\u63a8\u8350\u67b6\u6784&#xff1a;<\/li>\n<\/ul>\n<p>\/\/ \u5ba2\u6237\u7aef\u5165\u53e3<br \/>\nimport { createSSRApp } from &#039;vue&#039;<br \/>\nimport App from &#039;.\/App.vue&#039;<br \/>\nif (!import.meta.env.SSR) {<br \/>\n  createSSRApp(App).mount(&#039;#app&#039;)<br \/>\n}<br \/>\n\/\/ \u670d\u52a1\u7aef\u5165\u53e3<br \/>\nexport async function render(url) {<br \/>\n  const { app, router } &#061; createApp()<br \/>\n  await router.push(url)<br \/>\n  const html &#061; await renderToString(app)<br \/>\n  return html<br \/>\n}<\/p>\n<ul>\n<li>\u6784\u5efa\u914d\u7f6e\u5173\u952e\u70b9&#xff1a;<\/li>\n<\/ul>\n<p>\/\/ vite.config.js<br \/>\nexport default {<br \/>\n  build: {<br \/>\n    ssr: true, \/\/ \u6807\u8bb0SSR\u6784\u5efa<br \/>\n    ssrManifest: true, \/\/ \u751f\u6210manifest\u6587\u4ef6<br \/>\n    rollupOptions: {<br \/>\n      input: &#039;src\/entry-server.js&#039; \/\/ \u6307\u5b9aSSR\u5165\u53e3<br \/>\n    }<br \/>\n  }<br \/>\n}<\/p>\n<p>\u6027\u80fd\u5bf9\u6bd4&#xff1a;<\/p>\n<ul>\n<li>CSR\u9996\u5c4f&#xff1a;2.4s (TTFB 300ms)<\/li>\n<li>SSR\u4f18\u5316\u540e&#xff1a;1.1s (TTFB 80ms)<\/li>\n<\/ul>\n<p>\u6700\u540e\u9001\u4e0a\u4e00\u53e5\u7ecf\u9a8c\u4e4b\u8c08&#xff1a;<\/p>\n<p>Vite\u4e0d\u662f\u9b54\u6cd5&#xff0c;\u5b83\u7684\u5feb\u662f\u6709\u6761\u4ef6\u7684\u2014\u2014\u6b63\u786e\u7684\u4f9d\u8d56\u5212\u5206\u3001\u7cbe\u51c6\u7684\u5206\u7247\u7b56\u7565\u3001SSR\u7684\u6df1\u5ea6\u4f18\u5316&#xff0c;\u7f3a\u4e00\u4e0d\u53ef\u3002\u4f60\u5728\u9879\u76ee\u4e2d\u662f\u600e\u4e48\u5904\u7406\u8fd9\u4e9b\u75db\u70b9\u7684&#xff1f;\u6b22\u8fce\u5206\u4eab\u4f60\u7684\u5b9e\u6218\u6848\u4f8b\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\\&#8221;\u4e3a\u4ec0\u4e48\u7528\u4e86Vite&#xff0c;\u9996\u5c4f\u8fd8\u662f\u6162&#xff1f;\\&#8221;\u53bb\u5e74\u63a5\u624b\u4e00\u4e2a\u4e2d\u53f0\u9879\u76ee\u65f6&#xff0c;\u6211\u76ef\u7740Chrome DevTools\u91cc\u957f\u8fbe3\u79d2\u7684LCP\u6307\u6807&#xff0c;\u53d1\u73b0Vite\u7684\\&#8221;\u95ea\u7535\u822c\\&#8221;\u5f00\u53d1\u4f53\u9a8c\u5e76\u6ca1\u6709\u81ea\u52a8\u8f6c\u5316\u4e3a\u751f\u4ea7\u6027\u80fd\u3002\u7ecf\u8fc7\u4e24\u5468\u7684\u6df1\u5ea6\u8c03\u4f18&#xff0c;\u6700\u7ec8\u5c06LCP\u4ece3s\u538b\u5230800ms\u3002\u672c\u6587\u5c06\u5206\u4eab\u90a3\u4e9b\u4e0d\u4f1a\u51fa\u73b0\u5728\u5b98\u65b9\u6587\u6863\u91cc\u7684\u786c\u6838\u4f18\u5316\u624b\u6bb5\u3002<br \/>\n1. \u9884\u6784\u5efa&#xff1a;\u88ab\u5ffd\u89c6\u7684\u6027\u80fd\u9ed1\u6d1e<br \/>\n\u63a5\u624b\u7684\u662f\u4e00\u4e2a\u57fa\u4e8eVue 3  Vite\u7684\u7269\u6d41\u7ba1\u7406\u540e\u53f0&#xff0c;\u5f53\u4f9d\u8d56\u9879<\/p>\n","protected":false},"author":2,"featured_media":116643,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[7301,13232,9260,128,132],"topic":[],"class_list":["post-116644","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-7301","tag-13232","tag-9260","tag-api","tag-132"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Vite\u6027\u80fd\u4f18\u5316\u5b8c\u5168\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/116644.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Vite\u6027\u80fd\u4f18\u5316\u5b8c\u5168\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"&quot;\u4e3a\u4ec0\u4e48\u7528\u4e86Vite&#xff0c;\u9996\u5c4f\u8fd8\u662f\u6162&#xff1f;&quot;\u53bb\u5e74\u63a5\u624b\u4e00\u4e2a\u4e2d\u53f0\u9879\u76ee\u65f6&#xff0c;\u6211\u76ef\u7740Chrome DevTools\u91cc\u957f\u8fbe3\u79d2\u7684LCP\u6307\u6807&#xff0c;\u53d1\u73b0Vite\u7684&quot;\u95ea\u7535\u822c&quot;\u5f00\u53d1\u4f53\u9a8c\u5e76\u6ca1\u6709\u81ea\u52a8\u8f6c\u5316\u4e3a\u751f\u4ea7\u6027\u80fd\u3002\u7ecf\u8fc7\u4e24\u5468\u7684\u6df1\u5ea6\u8c03\u4f18&#xff0c;\u6700\u7ec8\u5c06LCP\u4ece3s\u538b\u5230800ms\u3002\u672c\u6587\u5c06\u5206\u4eab\u90a3\u4e9b\u4e0d\u4f1a\u51fa\u73b0\u5728\u5b98\u65b9\u6587\u6863\u91cc\u7684\u786c\u6838\u4f18\u5316\u624b\u6bb5\u3002 1. \u9884\u6784\u5efa&#xff1a;\u88ab\u5ffd\u89c6\u7684\u6027\u80fd\u9ed1\u6d1e  \u63a5\u624b\u7684\u662f\u4e00\u4e2a\u57fa\u4e8eVue 3 Vite\u7684\u7269\u6d41\u7ba1\u7406\u540e\u53f0&#xff0c;\u5f53\u4f9d\u8d56\u9879\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/116644.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-21T15:49:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261021154917-6ad8defd12802.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/116644.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/116644.html\",\"name\":\"Vite\u6027\u80fd\u4f18\u5316\u5b8c\u5168\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-21T15:49:18+00:00\",\"dateModified\":\"2026-10-21T15:49:18+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/116644.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/116644.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/116644.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Vite\u6027\u80fd\u4f18\u5316\u5b8c\u5168\u6307\u5357\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Vite\u6027\u80fd\u4f18\u5316\u5b8c\u5168\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/116644.html","og_locale":"zh_CN","og_type":"article","og_title":"Vite\u6027\u80fd\u4f18\u5316\u5b8c\u5168\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\"\u4e3a\u4ec0\u4e48\u7528\u4e86Vite&#xff0c;\u9996\u5c4f\u8fd8\u662f\u6162&#xff1f;\"\u53bb\u5e74\u63a5\u624b\u4e00\u4e2a\u4e2d\u53f0\u9879\u76ee\u65f6&#xff0c;\u6211\u76ef\u7740Chrome DevTools\u91cc\u957f\u8fbe3\u79d2\u7684LCP\u6307\u6807&#xff0c;\u53d1\u73b0Vite\u7684\"\u95ea\u7535\u822c\"\u5f00\u53d1\u4f53\u9a8c\u5e76\u6ca1\u6709\u81ea\u52a8\u8f6c\u5316\u4e3a\u751f\u4ea7\u6027\u80fd\u3002\u7ecf\u8fc7\u4e24\u5468\u7684\u6df1\u5ea6\u8c03\u4f18&#xff0c;\u6700\u7ec8\u5c06LCP\u4ece3s\u538b\u5230800ms\u3002\u672c\u6587\u5c06\u5206\u4eab\u90a3\u4e9b\u4e0d\u4f1a\u51fa\u73b0\u5728\u5b98\u65b9\u6587\u6863\u91cc\u7684\u786c\u6838\u4f18\u5316\u624b\u6bb5\u3002 1. \u9884\u6784\u5efa&#xff1a;\u88ab\u5ffd\u89c6\u7684\u6027\u80fd\u9ed1\u6d1e  \u63a5\u624b\u7684\u662f\u4e00\u4e2a\u57fa\u4e8eVue 3 Vite\u7684\u7269\u6d41\u7ba1\u7406\u540e\u53f0&#xff0c;\u5f53\u4f9d\u8d56\u9879","og_url":"https:\/\/www.wsisp.com\/helps\/116644.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-21T15:49:18+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261021154917-6ad8defd12802.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/116644.html","url":"https:\/\/www.wsisp.com\/helps\/116644.html","name":"Vite\u6027\u80fd\u4f18\u5316\u5b8c\u5168\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-21T15:49:18+00:00","dateModified":"2026-10-21T15:49:18+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/116644.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/116644.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/116644.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Vite\u6027\u80fd\u4f18\u5316\u5b8c\u5168\u6307\u5357"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/116644","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=116644"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/116644\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/116643"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=116644"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=116644"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=116644"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=116644"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}