S
S
Shurik2020-06-10 16:20:29
Vue.js
Shurik, 2020-06-10 16:20:29

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

1 answer(s)
A
Aetae, 2020-06-10
@Aetae

In node_modulesthe assembled ready-made packages lie, you do not need to climb there.
The project structure created vue-clicorresponds (obviously) to the selected options.
But this structure is not something sacred and only true. Everything that you have created vue-cliyou 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_modulesand 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-clidoes this for you when choosing options, but this is a feature vue-cli, not an inherent property of the npmpackages.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question