{"id":10008356,"date":"2024-02-16T18:37:56","date_gmt":"2024-02-16T10:37:56","guid":{"rendered":"https:\/\/blog.itmax.cn\/?p=10008356"},"modified":"2024-02-16T18:37:56","modified_gmt":"2024-02-16T10:37:56","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8vscode%e4%b8%ad%e8%b0%83%e8%af%95%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10008356","title":{"rendered":"\u5982\u4f55\u5728vscode\u4e2d\u8c03\u8bd5\u4ee3\u7801?"},"content":{"rendered":"<h2>\u4f7f\u7528\u6b65\u9aa4<\/h2>\n<p>1 \u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u9762\u521b\u5efa<code>.\/vscode\/launch.json<\/code>\u6587\u4ef6\uff0c\u5185\u5bb9\u5982\u4e0b<\/p>\n<pre><code class=\"json\">{\n  &quot;version&quot;: &quot;0.2.0&quot;,\n  &quot;configurations&quot;: [\n    {\n      &quot;name&quot;: &quot;Launch Chrome&quot;,\n      &quot;type&quot;: &quot;chrome&quot;,\n      &quot;request&quot;: &quot;launch&quot;,\n      &quot;url&quot;: &quot;http:\/\/localhost:3000&quot;,\n      &quot;webRoot&quot;: &quot;${workspaceFolder}\/src&quot;,\n      &quot;sourceMapPathOverrides&quot;: {\n        &quot;webpack:\/\/\/src\/*&quot;: &quot;${webRoot}\/*&quot;\n      }\n    }\n  ]\n}<\/code><\/pre>\n<p>2 \u542f\u52a8\u4f60\u7684\u672c\u5730\u9879\u76ee<br \/>\u793a\u4f8b<code>npm start<\/code><\/p>\n<p>3 \u6309<code>f5<\/code>\u542f\u52a8\u8c03\u8bd5<br \/><code>vscode<\/code>\u4f1a\u81ea\u52a8\u6253\u5f00\u6d4f\u89c8\u5668\uff0c\u7136\u540e\u8df3\u8f6c\u81f3\u4e0a\u8ff0\u914d\u7f6e\u4e2d<code>url<\/code>\u6307\u5411\u7684\u5730\u5740\u3002<\/p>\n<p>4 \u6dfb\u52a0\u65ad\u70b9<br \/>\u5728<code>vscode<\/code>\u4e2d\u627e\u5230\u9700\u8981\u6dfb\u52a0\u65ad\u70b9\u7684\u4ee3\u7801\u884c\uff0c\u70b9\u51fb\u884c\u53f7\u5de6\u4fa7\u6dfb\u52a0\u65ad\u70b9\u3002<br \/><img loading=\"lazy\" decoding=\"async\" width=\"723\" height=\"118\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdbrvd\" alt=\"image.png\" title=\"image.png\"><\/p>\n<p>5 \u5237\u65b0\u6d4f\u89c8\u5668\uff0c\u5f53\u8fd0\u884c\u5230\u65ad\u70b9\u5904\uff0c\u4ee3\u7801\u5c31\u4f1a\u505c\u4f4f\uff0c\u7136\u540e\u4f60\u5c31\u53ef\u4ee5\u5f00\u59cb\u8c03\u8bd5\u4f60\u7684\u4ee3\u7801\u4e86\u3002<br \/><img decoding=\"async\" width=\"723\" height=\"188\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdbrvg\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h2>\u914d\u7f6e\u9879\u4ecb\u7ecd<\/h2>\n<p>url<br \/>\u586b\u5199\u4f60\u672c\u5730\u542f\u52a8\u9879\u76ee\u7684\u5730\u5740\u3002<\/p>\n<h2>\u4f7f\u7528attch\u6a21\u5f0f<\/h2>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f7f\u7528\u7684\u662f<code>launch<\/code>\u6a21\u5f0f\uff0c\u4e5f\u5c31\u662f<code>vscode<\/code>\u4f1a\u81ea\u52a8\u6253\u5f00\u4e00\u4e2a\u6d4f\u89c8\u5668\u7a97\u53e3\u8fdb\u884c\u8c03\u8bd5\uff0c\u4e0d\u8fc7\u6709\u65f6\u5019\u8fd9\u5e76\u4e0d\u662f\u6211\u4eec\u60f3\u8981\u7684\u3002\u6211\u4eec\u53ef\u80fd\u5df2\u7ecf\u8fd0\u884c\u4e86\u4e00\u4e2a\u7a97\u53e3\uff0c\u7136\u540e\u60f3\u5bf9\u8fd9\u4e2a\u5df2\u5b58\u5728\u7684\u7a97\u53e3\u8fdb\u884c\u8c03\u8bd5\uff0c\u8fd9\u79cd\u60c5\u51b5\u5c31\u53ef\u4ee5\u4f7f\u7528<code>attach<\/code>\u6a21\u5f0f\u3002<\/p>\n<p><strong>\u6b65\u9aa4\uff1a<\/strong><br \/>1 \u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u9762\u521b\u5efa<code>.\/vscode\/launch.json<\/code>\u6587\u4ef6\uff0c\u5185\u5bb9\u5982\u4e0b<\/p>\n<pre><code class=\"json\">{\n  &quot;version&quot;: &quot;0.2.0&quot;,\n  &quot;configurations&quot;: [\n    {\n      &quot;name&quot;: &quot;Attach to Chrome&quot;,\n      &quot;type&quot;: &quot;chrome&quot;,\n      &quot;request&quot;: &quot;attach&quot;,\n      &quot;port&quot;: 9222,\n      &quot;url&quot;: &quot;http:\/\/localhost:3000&quot;,\n      &quot;webRoot&quot;: &quot;${workspaceFolder}\/src&quot;\n    }\n  ]\n}<\/code><\/pre>\n<p>2 \u7ed9<code>chrome<\/code>\u6d4f\u89c8\u5668\u5feb\u6377\u65b9\u5f0f\u7684\u76ee\u6807\u5b57\u6bb5\u6dfb\u52a0\u53c2\u6570<br \/>\u53c2\u6570\u4e3a<code>--remote-debugging-port=9222<\/code>\uff08\u5173\u952e\u6b65\u9aa4\uff09<\/p>\n<p>\u5b8c\u6574\u7684\u503c\u4f1a\u50cf\u8fd9\u6837\uff1a<br \/><code>&quot;C:\/Program Files\/Google\/Chrome\/Application\/chrome.exe&quot; --remote-debugging-port=9222<\/code><\/p>\n<p>3 \u542f\u52a8\u4f60\u7684\u672c\u5730\u9879\u76ee<br \/>\u793a\u4f8b<code>npm start<\/code><\/p>\n<p>4 \u6309<code>f5<\/code>\u542f\u52a8\u8c03\u8bd5<br \/><code>vscode<\/code>\u4f1a\u5173\u8054\u5230\u5df2\u7ecf\u6253\u5f00\u7684\u9879\u76ee\u5730\u5740\uff0c\u4e5f\u5c31\u662f\u4e0a\u8ff0\u914d\u7f6e\u4e2d<code>url<\/code>\u6307\u5411\u7684\u5730\u5740\u3002<\/p>\n<p>\u6ce8\u610f\uff1a\u6253\u5f00\u8fd9\u4e2a\u5730\u5740\u7684<code>chrome<\/code>\u7a97\u53e3\uff0c\u76ee\u6807\u53c2\u6570\u5fc5\u987b\u6709<code>remote-debugging-port=9222<\/code>\uff0c\u5426\u5219\u4f1a\u62a5\u5982\u4e0b\u9519\u8bef\uff1a<br \/><img decoding=\"async\" width=\"723\" height=\"172\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdbryH\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>5 \u6dfb\u52a0\u65ad\u70b9<br \/>\u5728<code>vscode<\/code>\u4e2d\u627e\u5230\u9700\u8981\u6dfb\u52a0\u65ad\u70b9\u7684\u4ee3\u7801\u884c\uff0c\u70b9\u51fb\u884c\u53f7\u5de6\u4fa7\u6dfb\u52a0\u65ad\u70b9\u3002<br \/><img decoding=\"async\" width=\"723\" height=\"118\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdbrvd\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>6 \u5237\u65b0\u6d4f\u89c8\u5668\uff0c\u5f53\u8fd0\u884c\u5230\u65ad\u70b9\u5904\uff0c\u4ee3\u7801\u5c31\u4f1a\u505c\u4f4f\uff0c\u7136\u540e\u4f60\u5c31\u53ef\u4ee5\u5f00\u59cb\u8c03\u8bd5\u4f60\u7684\u4ee3\u7801\u4e86\u3002<br \/><img decoding=\"async\" width=\"723\" height=\"188\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdbrvg\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000044633990\">https:\/\/segmentfault.com\/a\/1190000044633990<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528\u6b65\u9aa4 1 \u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u9762\u521b\u5efa.\/vscode\/launch.json\u6587\u4ef6\uff0c\u5185\u5bb9\u5982\u4e0b { &quot;ve [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10008356","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008356","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10008356"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008356\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10008356"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10008356"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10008356"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}