vue 发布build 本地设置 相对路径 两个地方 一个根目录用./ css文件里面用../../

Posted 彭成刚_Reciter | 技术博客

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vue 发布build 本地设置 相对路径 两个地方 一个根目录用./ css文件里面用../../相关的知识,希望对你有一定的参考价值。

build: {
    // Template for index.html
    index: path.resolve(__dirname, ‘../dist/index.html‘),

    // Paths
    assetsRoot: path.resolve(__dirname, ‘../dist‘),
    assetsSubDirectory: ‘../../static‘,
    assetsPublicPath: ‘./‘,

  config/index.js

 

问题是这样改完了,根index.html路径也不对,最后还是得手改

<!DOCTYPE html>
<html>

<head>
  <meta charset=utf-8>
  <meta name=viewport content="width=device-width,initial-scale=1">
  <title>iviewdemo</title>
  <link href=./../../static/css/app.0a6ba3b3dba53fc983a09ef477b088f9.css rel=stylesheet>
</head>

<body>
  <div id=app></div>
  <script type=text/javascript src=./../../static/js/manifest.06afec52e97ebf804504.js> </script> <script type=text/javascript
    src=./../../static/js/vendor.863170c738aad3e88771.js> </script> <script type=text/javascript src=./../../static/js/app.2ca91cd92c83d3402260.js>
    </script> </body> </html>

  

以上是关于vue 发布build 本地设置 相对路径 两个地方 一个根目录用./ css文件里面用../../的主要内容,如果未能解决你的问题,请参考以下文章

vue的图片路径引用问题解决

设置全局 gradle build dir 相对路径

vue-cli项目 build后请求本地static文件中的 json数据,路径不对,报错404处理方法

本地运行vue dist文件

vue项目打包后资源相对引用路径的和背景图片路径问题

backgroundImage 路径问题 vue 图片的引入方式