در حال بارگذاری ...

Installing Vue VS Code extension0:00

Now, I still have this example project opened. So let's go into Resources, Assets, JS, and let's take a look at any of these components. How about ImageUpload? Now, immediately, I see, oh, there's no formatting here because VS Code doesn't recognize Vue files. But luckily, it recommends we pull in this VTUR extension. Let's do it. All right. Well, while that's installing, we can do a quick review. Here's what it offers.

Reviewing Vue component imports0:39

That looks so much better. Now, I'm looking for imports, but it looks like this one doesn't have it. Let's go to reply.vue instead. Here we go. So you'll see that we have two imports, Moment.js and this Favorite component. We'll take a look. We'll hit Shift-Command-X and we will install the extension import-cost. This is pretty useful. Let me show you what it does. Give that just a moment.

Installing import-cost extension0:59

Let me show you what it does. Give that just a moment. All right. And we'll give that a reload. So now, if we go back to reply.vue, I would expect to see the cost of each import, the file size. But now because this is a .vue file, I'm not going to see it out of the box. Take a look at this. import-cost. And let's see.

Configuring import-cost for Vue1:16

Import-cost. And let's see. We should see two options here to specify. As I understand it, even though we're not using TypeScript, this is a good choice to choose. Go figure. So Command-Comma, and I will paste this in right here. And in our case, we want to recognize Vue files. All right. Let's close that out.

Evaluating dependency import sizes1:35

All right. Let's close that out. Let's go back to reply.vue, and instantly we can see a little bit of feedback there. That's not real text. It's not going to break your code. It's just a little bit of feedback for you. So now, if I didn't know before, I can see, oh, Moment is actually a very big dependency. So I need to make sure I optimize that as best as possible, or maybe even switch to an alternative. You'll see this even more.

دوست دارید گاهی خبرهای Laracasts را ایمیل کنیم؟