到config文件夹中打开index.js文件
build: { // Template for index.html index: path.resolve(__dirname, ‘../dist/index.html‘), // Paths assetsRoot: path.resolve(__dirname, ‘../dist‘), assetsSubDirectory: ‘static‘, assetsPublicPath: ‘./‘, //修改这行
assetsPublicPath属性作用是指定编译发布的根目录,‘/‘指的是项目的根目录 ,‘./‘指的是当前目录。
原文:https://www.cnblogs.com/zyfeng/p/13358718.html