My vue project is completed. When I run script 'npm run build',which is 'vue-cli-service build', I can get a pack of output files. However in index.html file, all js and css files' path are not right. for example:
<script src=js/chunk-vendors.40fba41b.js>
Correct one should be:
<script src="./js/chunk-vendors.40fba41b.js">
I googled a lot. Some said to modify webpack's config, which I found out impossible since vue-cli3 does not provide such config file. Some said it can be done by adding baseurl in vue.config.js file like this:
module.exports = {
baseUrl: "./",
}
When I set baseUrl as './', the problem remains. When I change baseUrl to "somecode/", the output files would be:
<script src=somecode/js/chunk-vendors.40fba41b.js>
I am really confused by it. Why and how to fix this problem? Thanks in advance.
history.pushStateor build a multi page app with thepageoption because relativebaseUrlhas some limitation. cf: cli.vuejs.org/config/#baseurl