You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/v2/cookbook/debugging-in-vscode.md
+32-32
Original file line number
Diff line number
Diff line change
@@ -1,35 +1,35 @@
1
1
---
2
-
title: Debugging in VS Code (EN)
2
+
title: Déboguer dans VS Code
3
3
type: cookbook
4
4
order: 8
5
5
---
6
6
7
-
<p>Cette page est en cours de traduction. Pour nous aider, vous pouvez participer sur <ahref="https://github.com/vuejs-fr/vuejs.org"target="_blank">le dépôt GitHub dédié de Vuejs-FR</a>.</p><p>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.</p>
7
+
<p>Chaque application atteint un point où il est nécessaire de comprendre les défaillances, petites ou grandes. Dans ce tutoriel, nous explorons quelques workflows pour les utilisateurs de VS Code qui souhaitent déboguer leur application dans le navigateur.</p>
8
8
9
-
This recipe shows how to debug [Vue CLI](https://github.com/vuejs/vue-cli)applications in VS Code as they run in the browser.
9
+
Ce tutoriel montre comment déboguer les applications en utilisant [Vue CLI](https://github.com/vuejs/vue-cli)dans VS Code comme si elles tournaient dans un navigateur.
10
10
11
-
<pclass="tip">Note: This recipe covers Chrome and Firefox. If you know how to setup VS Code debugging with other browsers, please consider sharing your insights (see bottom of the page).</p>
11
+
<pclass="tip">Note: Ce tutoriel couvre Chrome et Firefox. Si vous savez comment configurer le débogage de VS Code avec d'autres navigateurs, veuillez envisager de partager vos idées (voir en bas de la page).</p>
12
12
13
-
## Prerequisites
13
+
## Prérequis
14
14
15
-
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:
15
+
Assurez-vous d'avoir installé VS Code et le navigateur de votre choix, et que la dernière version de l'extension Debugger correspondante est installée et activée :
16
16
17
-
*[Debugger for Chrome](https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome)
18
-
*[Debugger for Firefox](https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-firefox-debug)
17
+
*[Debugger pour Chrome](https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome)
18
+
*[Debugger pour Firefox](https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-firefox-debug)
19
19
20
-
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.
20
+
Installez et créez un projet avec la[vue-cli](https://github.com/vuejs/vue-cli), en suivant les instructions de la section [Guide Vue CLI](https://cli.vuejs.org/). Allez dans le répertoire nouvellement créé et ouvrez VS Code.
21
21
22
-
### Displaying Source Code in the Browser
22
+
### Affichage du code source dans le navigateur
23
23
24
-
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.
24
+
Avant de pouvoir déboguer vos composants Vue à partir de VS Code, vous devez mettre à jour la configuration webpack générée pour construire des sourcemaps. Nous faisons cela pour que notre débogueur ait un moyen de mapper le code d'un fichier compressé à sa position dans le fichier d'origine. Ceci vous permet de déboguer une application même après que vos ressources aient été optimisées par webpack.
25
25
26
-
If you use Vue CLI 2, set or update the `devtool`property inside `config/index.js`:
26
+
Si vous utilisez Vue CLI 2, définissez ou mettez à jour le paramètre `devtool`dans `config/index.js`:
27
27
28
28
```json
29
29
devtool: 'source-map',
30
30
```
31
31
32
-
If you use Vue CLI 3, set or update the `devtool`property inside `vue.config.js`:
32
+
Si vous utilisez Vue CLI 3, définissez ou mettez à jour le paramètre `devtool`dans `vue.config.js`:
33
33
34
34
```js
35
35
module.exports= {
@@ -39,13 +39,13 @@ module.exports = {
39
39
}
40
40
```
41
41
42
-
### Launching the Application from VS Code
42
+
### Lancement de l'application à partir de VS Code
43
43
44
-
<pclass="tip">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.</p>
44
+
<pclass="tip">Nous supposons ici que le port est le `8080`. Si ce n'est pas le cas (par exemple, si le port `8080` a été pris et que Vue CLI a choisi automatiquement un autre port pour vous), modifiez simplement la configuration en conséquence.</p>
45
45
46
-
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:
46
+
Cliquez sur l'icône Débogage dans la barre d'activités pour afficher la vue Débogage, puis cliquez sur l'icône en forme d'écrou pour configurer un fichier launch.json, en sélectionnant **Chrome/Firefox: Launch**comme environnement. Remplacez le contenu du fichier launch.json généré par la configuration correspondante :

82
82
83
-
2.Open your favorite terminal at the root folder and serve the app using Vue CLI:
83
+
2.Ouvrez votre terminal favori dans le dossier racine et lancez l'application en utilisant Vue CLI:
84
84
85
85
```
86
86
npm run serve
87
87
```
88
88
89
-
3.Go to the Debug view, select the **'vuejs: chrome/firefox'** configuration, then press F5 or click the green play button.
89
+
3.Allez dans la vue Débogage, sélectionnez la configuration **'vuejs: chrome/firefox'**, puis appuyez sur F5 ou cliquez sur le bouton vert de lecture.
90
90
91
-
4.Your breakpoint should now be hit as a new browser instance opens`http://localhost:8080`.
91
+
4.Votre point d'arrêt devrait maintenant être atteint dès qu'une nouvelle instance de navigateur ouvre`http://localhost:8080`.
92
92
93
-

93
+

94
94
95
-
## Alternative Patterns
95
+
## Modèles alternatifs
96
96
97
97
### Vue Devtools
98
98
99
-
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.
99
+
Il existe d'autres méthodes de débogage, plus ou moins complexes. Le plus simple et le plus populaire est d'utiliser l'excellent outil Vue.js devtools [pour Chrome](https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd)et [pour Firefox](https://addons.mozilla.org/en-US/firefox/addon/vue-js-devtools/). Certains des avantages de travailler avec les outils Vue.js devtools sont qu'ils vous permettent d'éditer en direct les propriétés des données et de voir les changements se refléter immédiatement. L'autre avantage majeur est la possibilité de déboguer en revenant dans le temps pour Vuex.

102
102
103
-
<pclass="tip">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.</p>
103
+
<pclass="tip">Veuillez noter que si la page utilise une version de Vue.js de production/minifiée (comme le lien standard d'un CDN), l'inspection via Vue.js devtools est désactivée par défaut et le volet Vue n'apparaîtra pas. Si vous passez à une version non minifiée, vous devrez peut-être rafraîchir la page pour les voir.</p>
104
104
105
-
### Simple Debugger Statement
105
+
### La simple instruction Debugger
106
106
107
-
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.
107
+
L'exemple ci-dessus a un excellent workflow. Cependant, il y a une autre option où vous pouvez utiliser l'[instruction du débogueur natif](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/debugger)directement dans votre code. Si vous choisissez de travailler de cette façon, il est important que vous vous souveniez d'enlever les instructions lorsque vous avez terminé.
108
108
109
109
```js
110
110
<script>
@@ -123,6 +123,6 @@ export default {
123
123
</script>
124
124
```
125
125
126
-
## Acknowledgements
126
+
## Remerciements
127
127
128
-
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).
128
+
Ce tutoriel est basée sur une contribution de[Kenneth Auchenberg](https://twitter.com/auchenberg), [disponible ici](https://github.com/Microsoft/VSCode-recipes/tree/master/vuejs-cli).
0 commit comments