DEV Community

Discussion on: Creating Quasar Framework project with Typescript support (pre v1.9.6)

Collapse
 
gregveres profile image
gregveres

Nice article. And timely as I am just about to start a typescript based quasar project. Thank you for taking the time to put this together.

You have a typo that I thought I would point out.
"Now let's fix the problem with the store definition in the src/boot/i18n.ts file." is the first sentance in the section where you are about to describe the changes needed to the store file. Notice that the sentance is pointing to the i18n.ts file that you already fixed in the paragraph above it.

Greg

Collapse
 
gregveres profile image
gregveres

And actually, once I added in the === 'true', it still gives me an error in VSCode that process isn't defined. It suggests this:

Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig

Is this something that needs to be done? It doesn't quite seem right since we aren't talking about node.js at all.

Collapse
 
xkonti profile image
Xkonti • Edited

Thank you for pointing out this typo. I fixed it.

When it comes to the issue with missing definition of the process it requires the node.js typings. Keep in mind that this is mostly used during the build process and you don't have to worry about it in the production build. If you'll look into the repository of this template in the package.json in the devDependencies there is the @types/node included. I'm not sure why yours doesn't have it as I didn't add it manually.

Collapse
 
gregveres profile image
gregveres

for the missing definition of process, I think quiting VSCode and restarting it fixed the issue because it just went away without me doing anything to explicitly fix it.

do you know of a good article of how to structure a Vue/Vuex application for the real world? I am finding too many articles that try to teach Vuex without real world consideration for growth of the application. For instance, where is the split between Vue components and Vuex state when we get a non-trivial (ie, not another ToDo app) example.

Thanks for this article btw!

Thread Thread
 
xkonti profile image
Xkonti

It greatly depends on your applications. If you're building an application with lots of relatively not-complicated pages using a set of shared components the standard way of structuring the Vue app could be sufficient:

src/
├─ ...
├─ components
├─ layouts
├─ pages
└─ store
   ├─ some-module
   └─ other-module

But if you're building something more diverse you might want to go with more of a module-oriented structure: make separate modules where each module can contain structure described above. This is a good article on this topic: dev.to/maxpou/3-tips-for-scaling-l...

Keep in mind that project structure greatly depends on a personal preference and project type. Vue and Quasar Framework enable you to do whatever you want with it so you might need to take a trial and error approach to this problem to figure out what works for you best.

The point of separation of data between Vuex and a component is a whole another problem that requires some practice. I would suggest to minimize the amount of data in the Vuex store as lots of mutations can slow down the application. If you're planning building a larger application you might want to introduce distinctive separation between dumb components and smart components - never let your dumb components access the store directly. Let the smart components handle all the data and provide it to the dumb components.

You should read couple articles about those topics as lines are quite often blurry.