Skip to content

Commit 596cbfe

Browse files
committed
docs: translate cookbook > debugging in vscode
1 parent d852aa2 commit 596cbfe

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

src/cookbook/debugging-in-vscode.md

+26-26
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
# Debugging in VS Code
1+
# VS Code でのデバッグ
22

3-
Every application reaches a point where it's necessary to understand failures, small to large. In this recipe, we explore a few workflows for VS Code users who would like to debug their application in the browser.
3+
あらゆるアプリケーションは、小さなものから大きなものまでエラーを理解する必要がある段階に到達します。このレシピでは、 VS Code ユーザがブラウザでアプリケーションをデバッグするためのワークフローをいくつか紹介します。
44

5-
This recipe shows how to debug [Vue CLI](https://github.com/vuejs/vue-cli) applications in VS Code as they run in the browser.
5+
このレシピでは、 [Vue CLI](https://github.com/vuejs/vue-cli) アプリケーションをブラウザで実行しながら、 VS Code でデバッグする方法を紹介します。
66

7-
## Prerequisites
7+
## 必要なもの
88

9-
Make sure you have VS Code and the browser of your choice installed, and the latest version of the corresponding Debugger extension installed and enabled:
9+
VS Code と好みのブラウザがインストールされていて、対応するデバッガー拡張機能の最新バージョンがインストールされ、有効化されていることを確認してください:
1010

1111
- [Debugger for Chrome](https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome)
1212
- [Debugger for Firefox](https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-firefox-debug)
1313

14-
Install and create a project with the [vue-cli](https://github.com/vuejs/vue-cli), following the instructions in the [Vue CLI Guide](https://cli.vuejs.org/). Change into the newly created application directory and open VS Code.
14+
[Vue CLI ガイド](https://cli.vuejs.org/) の説明にしたがって、 [vue-cli](https://github.com/vuejs/vue-cli) をインストールしてプロジェクトを作成します。新しく作成したアプリケーションのディレクトリに移動して、 VS Code を開きます。
1515

16-
### Displaying Source Code in the Browser
16+
### ブラウザにソースコードを表示
1717

18-
Before you can debug your Vue components from VS Code, you need to update the generated Webpack config to build sourcemaps. We do this so that our debugger has a way to map the code within a compressed file back to its position in the original file. This ensures that you can debug an application even after your assets have been optimized by Webpack.
18+
VS Code で Vue コンポーネントをデバッグできるようにする前に、生成された Webpack の設定を更新してソースマップをビルドする必要があります。これはデバッガが圧縮ファイルの中のコードを、元のファイルの位置に一致させる方法を持つためです。これにより、アセットが Webpack で最適化された後でも、アプリケーションのデバッグが可能になります。
1919

20-
If you use Vue CLI 2, set or update the `devtool` property inside `config/index.js`:
20+
Vue CLI 2 を使っているならば、`config/index.js` 内の `devtool` プロパティを設定、または更新してください:
2121

2222
```json
2323
devtool: 'source-map',
2424
```
2525

26-
If you use Vue CLI 3, set or update the `devtool` property inside `vue.config.js`:
26+
使っているのが Vue CLI 3 ならば、`vue.config.js` 内の `devtool` プロパティを設定、または更新してください:
2727

2828
```js
2929
module.exports = {
@@ -33,13 +33,13 @@ module.exports = {
3333
}
3434
```
3535

36-
### Launching the Application from VS Code
36+
### VS Code からアプリケーションを起動
3737

3838
::: info
39-
We're assuming the port to be `8080` here. If it's not the case (for instance, if `8080` has been taken and Vue CLI automatically picks another port for you), just modify the configuration accordingly.
39+
ここではポートを `8080` と仮定します。そうでない場合(例えば `8080` が使われていて、Vue CLI が自動的に別のポートを選択したとき)は、適宜設定を変更してください。
4040
:::
4141

42-
Click on the Debugging icon in the Activity Bar to bring up the Debug view, then click on the gear icon to configure a launch.json file, selecting **Chrome/Firefox: Launch** as the environment. Replace content of the generated launch.json with the corresponding configuration:
42+
アクティビティバーのデバッグアイコンをクリックして、デバッグ表示に切り替え、歯車アイコンをクリックして launch.json ファイルを設定したら、環境として **Chrome/Firefox: Launch** を選択します。生成された launch.json の内容を対応する設定に置き換えます:
4343

4444
![Add Chrome Configuration](/images/config_add.png)
4545

@@ -70,37 +70,37 @@ Click on the Debugging icon in the Activity Bar to bring up the Debug view, then
7070
}
7171
```
7272

73-
## Setting a Breakpoint
73+
## ブレークポイントの設定
7474

75-
1. Set a breakpoint in **src/components/HelloWorld.vue** on `line 90` where the `data` function returns a string.
75+
1. **src/components/HelloWorld.vue** `line 90` にある `data` 関数が文字列を返す部分にブレークポイントを設定します。.
7676

7777
![Breakpoint Renderer](/images/breakpoint_set.png)
7878

79-
2. Open your favorite terminal at the root folder and serve the app using Vue CLI:
79+
2. ルートフォルダでお気に入りのターミナルを開き、Vue CLI を使ってアプリケーションを配信します:
8080

8181
```
8282
npm run serve
8383
```
8484

85-
3. Go to the Debug view, select the **'vuejs: chrome/firefox'** configuration, then press F5 or click the green play button.
85+
3. デバッグ表示に移動して、**'vuejs: chrome/firefox'** の設定を選択したら、F5 キーを押すか、緑色の再生ボタンをクリックします。
8686

87-
4. Your breakpoint should now be hit as a new browser instance opens `http://localhost:8080`.
87+
4. ブレークポイントに到達すると、新しいブラウザのインスタンスが `http://localhost:8080` を開きます。
8888

8989
![Breakpoint Hit](/images/breakpoint_hit.png)
9090

91-
## Alternative Patterns
91+
## 代替パターン
9292

93-
### Vue Devtools
93+
### Vue Devtools
9494

95-
There are other methods of debugging, varying in complexity. The most popular and simple of which is to use the excellent Vue.js devtools [for Chrome](https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd) and [for Firefox](https://addons.mozilla.org/en-US/firefox/addon/vue-js-devtools/). Some of the benefits of working with the devtools are that they enable you to live-edit data properties and see the changes reflected immediately. The other major benefit is the ability to do time travel debugging for Vuex.
95+
もっと複雑なデバッグの方法もあります。最も一般的で単純な方法は、優れた Vue.js devtools [Chrome 向け](https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd) [Firefox 向け](https://addons.mozilla.org/en-US/firefox/addon/vue-js-devtools/) を使うことです。Devtools を使うことのいくつかの利点は、データのプロパティを Live Edit(ライブエディット)して、その変更がすぐに反映されることです。その他の主な利点は、Vuex のタイムトラベルデバッグが可能になることです。
9696

9797
![Devtools Timetravel Debugger](/images/devtools-timetravel.gif)
9898

99-
Please note that if the page uses a production/minified build of Vue.js (such as the standard link from a CDN), devtools inspection is disabled by default so the Vue pane won't show up. If you switch to an unminified version, you may have to give the page a hard refresh to see them.
99+
Vue.js の本番向け・縮小化ビルド(CDN からの標準的なリンクなど)を使っているページでは、Devtools の検知がデフォルトで無効になっているため、Vue ペインが表示されないことに注意してください。縮小されていないバージョンに切り替えた場合は、それを表示するためにページのハード再読み込みが必要になるかもしれません。
100100

101-
### Simple Debugger Statement
101+
### 単純な Debugger の記述
102102

103-
The example above has a great workflow. However, there is an alternative option where you can use the [native debugger statement](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/debugger) directly in your code. If you choose to work this way, it's important that you remember to remove the statements when you're done.
103+
上記の例はすばらしいワークフローを持っています。しかし、[ネイティブの debugger ](https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Statements/debugger) をコードの中で直接使うという別の方法もあります。この方法を選択した場合には、作業が終わったらこの debugger 文を削除することを忘れないようにするのが重要です。
104104

105105
```vue
106106
<script>
@@ -119,6 +119,6 @@ export default {
119119
</script>
120120
```
121121

122-
## Acknowledgements
122+
## 謝辞
123123

124-
This recipe was based on a contribution from [Kenneth Auchenberg](https://twitter.com/auchenberg), [available here](https://github.com/Microsoft/VSCode-recipes/tree/master/vuejs-cli).
124+
このレシピは、[Kenneth Auchenberg](https://twitter.com/auchenberg) 氏からの寄稿を元にしています。[元の記事](https://github.com/Microsoft/VSCode-recipes/tree/master/vuejs-cli)

0 commit comments

Comments
 (0)