After completing my Vue project, I encountered an issue when running the script 'npm run build' (vue-cli-service build). The output files were generated as expected, but the paths to all js and css files in the index.html file were incorrect. For example:
<script src=js/chunk-vendors.40fba41b.js>
The correct path should be:
<script src="./js/chunk-vendors.40fba41b.js">
I researched extensively to find a solution. Some suggested modifying webpack's config, but since vue-cli3 does not offer a config file for this purpose, it was not possible. Others recommended adding baseUrl in the vue.config.js file like this:
module.exports = {
baseUrl: "./",
}
However, setting baseUrl to './' did not resolve the problem. When I changed baseUrl to "somecode/", the output files had paths like:
<script src=somecode/js/chunk-vendors.40fba41b.js>
This situation has left me quite perplexed. Can someone explain why this is happening and how to fix it? Your help is greatly appreciated.