Answer the question
In order to leave comments, you need to log in
Why a different project structure with different installations of Vue and libraries?
Hello. Completely confused with installing vue. Please help me figure it out.
1. I create a project "vue create frontend". I choose, let's say manual installation and tick vuex and vue-router. As expected in the project folder in the src folder after installation, there are two folders - router and store, which has its own index.js where I work with the router and storage, respectively.
2. I create a project "vue create frontend". At the beginning of the installation, I select the default installation. Then I deliver vuex and vue-router separately. Everything is installed, but I do not see the aforementioned folders with these modules. But they appear in the node_modules folder. What's the Difference?
3. While experimenting, I noticed a difference in the settings for the first scenario. My frontend is built in the root folder of the backend in the dist folder. After that, by clicking on the links of the start page in the address bar, for example, by clicking on the about link, dist is added. Those. localhost:8000/dist/about. Previously, when I collected the frontend, this was not observed. After the next experimental build, instead of dist, the path already had #.
I'm guessing it's a matter of settings. And yes, why doesn't the vue.config.js file appear after installation? it should be? you have to create it manually.
And the last thing - in the page code for all installation options, an inscription appeared - We're sorry but frontend doesn't work properly without JavaScript enabled. Please enable it to continue.
Google did not give a specific answer to this (
Answer the question
In order to leave comments, you need to log in
In node_modules
the assembled ready-made packages lie, you do not need to climb there.
The project structure created vue-cli
corresponds (obviously) to the selected options.
But this structure is not something sacred and only true. Everything that you have created vue-cli
you can create manually. Or create a completely different structure. Only the logic in the code is important, daddies are not important.
So by manually installing some packages, you are doing exactly that: installing packages. Those. (exaggerating) just put them in node_modules
and write their presence in package.json
.
It doesn't affect your code in any way. If you want to use them in code, you must use them in code. It's up to you to create separate files and folders, or simply connect to existing ones.
vue-cli
does this for you when choosing options, but this is a feature vue-cli
, not an inherent property of the npm
packages.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question