-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add in debugging recipe, delete unused categories from cookbook TOC #1464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@auchenberg I would love to get your take on this as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Be aware that we have identified a few issues that also are present in Chrome DevTools: vuejs/vue-loader#1163
@@ -0,0 +1,132 @@ | |||
--- | |||
title: Debugging in VSCode and Chrome |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually say "VS Code" or "Visual Studio Code"
order: 6 | ||
--- | ||
|
||
Every application reaches a point where it's necessary to understand failures, small to large. In this recipe, we explore a few workflows for VSCode users, who are using Chrome to test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VS Code
|
||
## Prerequisites | ||
|
||
You must have Chrome and VSCode installed. Make sure to the latest version of [Debugger for Chrome](https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome) extension installed in VS Code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VS Code
Oh, that's too bad about the invalid sourcemaps. I'll synch with you offline about timeline. I can get the other changes in in the meantime. |
this.$reverseText('message') | ||
console.log(this.message) // => "olleH" | ||
console.log(this.message) // => "olleH" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like these will were probably automatically formatted by Prettier. We've previously followed the StandardJS conventions in the Vue docs, but I've actually been thinking about moving towards Standard + Prettier overall, with linting built into the project so this is probably OK.
|
||
## Prerequisites | ||
|
||
You must have Chrome and VS Code installed. Make sure to the latest version of [Debugger for Chrome](https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome) extension installed in VS Code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure to the latest version
Missing word here I think.
yarn global add @vue/cli | ||
|
||
vue create my-project | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if we should just defer people to the instructions in the Vue CLI README. That way, we don't have to update recipes if the API of Vue CLI changes. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that makes a lot of sense to me.
|
||
# if you have an alias set up (recommended) | ||
code . | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part doesn't necessarily have to be done in the terminal and I've found some people prefer to instead open VS Code, then open a folder from there. Maybe we should assume knowledge of how to use the basics of VS Code and just ask people to open the project folder? That way, we're not assuming an alias is set up and that this is how the user prefers to open projects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we don't mention here how to set up the alias, either, so this might avoid confusion
code . | ||
``` | ||
|
||
### Update your webpack configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When referring to project names, we use a Title Case convention (e.g. Webpack
instead of webpack
). We're also currently using Title Case for titles (e.g. Update Your Webpack Configuration
instead of Update your webpack configuration
).
|
||
### Update your webpack configuration | ||
|
||
Before you can debug your Vue components from VS Code you need to update the generated webpack config to build sourcemaps that contains more information for our debugger. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last time I'll mention it, but webpack
->Webpack
again here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sourcemaps that contains more information
contains
->contain
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should probably also be more specific than "more information for our debugger" for those who don't know what source maps are.
devtool: 'source-map', | ||
``` | ||
|
||
### Configure launch.json File |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
launch.json
should probably be in backticks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, with these titles, I wonder if it might be better to use titles that describe what we're trying to achieve, instead of the implementation details to get there.
For example, instead of Update your webpack configuration
, we could say Showing Source Code in the Chrome Devtools
. Then instead of Configure launch.json File
, we could say, Launching Our App from VS Code
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that makes more sense and is probably more easily googleable (not a word, but I'm keeping it)
} | ||
``` | ||
|
||
## Start Debugging An Application |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe Adding a Breakpoint
?
|
||
<p class="tip">There are a couple of gotchas to note for Vue Devtools: | ||
- If the page uses a production/minified build of Vue.js, devtools inspection is disabled by default so the Vue pane won't show up. | ||
- To make it work for pages opened via file:// protocol, you need to check "Allow access to file URLs" for this extension in Chrome's extension management panel</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whenever there's another doc that explains something in more detail, it's best to link to it so that we don't have to maintain multiple versions of the same instructions. In this case, I'd just link to the Vue Devtools README, since it contains all this information already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I'm thinking about keeping a note about it not working for minified version, but maybe changing the wording to say "for instance, using a CDN" because I get this question a ton and it really wouldn't hurt to have it in one more place, IMO.
Ok, I think I addressed all of the concerns in the review. Let me know if we need further changes :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Sourcemap issue made some traction, getting this recipe in there :) |
Kenneth Auchenberg wrote a great recipe for debugging Vue within VSCode, and we agreed it should live in our cookbook as well. In addition to his great contribution, I've also added: