A
A
Artem Voloshenko2021-03-04 12:32:40
Vue.js
Artem Voloshenko, 2021-03-04 12:32:40

Vue cli 2 in dist index folder with wrong paths!?

Such is the story of the project implemented on vue cli 2.
Here is its build, in the dist folder I find the index and folders with chunks.
But the joke is that in the index itself, the Links to connect css and js, files, in the paths are not the correct address.
That is, you have to add a dot at the beginning to each ref.
Then everything works, in principle it is not difficult to do, but why does this happen ?! and if I have a lot of third-party libraries, then this is a routine that I would like to avoid.
Google did not find a suitable answer.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Iaicox, 2021-03-04
@ArtSomellero

The problem is not entirely clear, with a well-configured project, the paths './' and '/' lead the same way.
When deploying, the page is just a white sheet?
There is a possibility that the point is that the publicPath was not specified correctly during the deployment, you can configure it in the root of the project in the vue.config.js file.
After the changes, rebuild. I also want to note that after rebuilding and deploying to the server, the changes may not immediately take effect (as for example on github-pages, it depends on the server), so I advise you to wait a while and check, and before that make sure that it is correct entered publicPath.

// В файле vue.config.js
module.exports = {
    publicPath: "/",  // тут прописать необходимый путь
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question