Vuex stores and vertical application architecture not working #12348
-
|
Hello everyone, we are building a large Quasar app. Until now, we used a horizontal architecture, which looked like this: src Inside the different horizontal layers, there were our application specific modules or "contexts". This looked like this: src As it is not best practice to build applications using a horizontal architecture anymore, we wanted to refactor the whole application, using a vertical approach, which is - as far as I know - the most maintainable solution. This should look like this: Everyhting worked fine during the refactoring. The quasar app compiles just fine. But when launching the app in the browser, I get the following error: Uncaught ReferenceError: can't access lexical declaration 'serverManagementStore' before initialization What I then did was that I put the main store ( which holds the stores of our vertical application slices as modules) into the root of the project But that did not fix the problem. I then found out, that in a Quasar app, alle modules of a store have to be in the same folder as the main store (which holds the modules) (https://quasar.dev/quasar-cli/vuex-store) Now I wonder: Is this the reason why I get this exception I mentioned above? Is there now way of implementing a complete vertical application architecture using quasar and vuex? I really would like to distribute the store modules into their respectice application slices. To be honest, doing something like this .. src ... doesn't feeld very good and does not follow best practices and current knowledge of developing enterprise applications. Thanks in advance for any helpful answers or some discussion! :) Maybe I am doing something wrong here ... |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
|
Hi 👋 However, the main problem here is happening because of how you are initializing and accessing some variables. According to the error message you give, the code is probably looking like this(or uses a similar principle): function test() {
console.log(serverManagementStore);
const serverManagementStore = 'whatever';
}Chromium-based: So, if you still can't figure out what's wrong, you will need to share a repro or some code in order for us to help. Good luck! |
Beta Was this translation helpful? Give feedback.


Hi 👋
First of all, if you want to use
src/core/storeinstead ofsrc/store, you can setquasar.conf.js > sourceFiles > storetosrc/core/store. Here is the documentation about it: https://quasar.dev/quasar-cli/quasar-conf-js#property-sourcefilesHowever, the main problem here is happening because of how you are initializing and accessing some variables. According to the error message you give, the code is probably looking like this(or uses a similar principle):
Chromium-based:
Firefox(exactly the same message):
So, if you still can't figure out what's wrong, you will need to share a rep…