vue publicpath
vue怎么设置publicpath呢?不知道的小伙伴来看看小编今天的分享吧!
1、每次打包build完后,都单独生成一个/dist文件夹,且dist中每次都只有相同文件目录
2、部署的时候,是部署在服务器的一个/test文件夹下
打包后的文件目录:
1
2
3
4
5
├─dist
├─css
├─img
└─js
index.html
1、不设置publicPath时,部署后请求路径:
1
2
3
4
5
// vue.config.js module.exports = { // publicPath: '',}
二、设置为/时,部署后请求路径:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html><html lang=en><head> <title>test</title> <link href=/css/app.0b79487b.css rel=preload as=style> <link href=/js/app.ba2d9b8a.js rel=preload as=script> <link href=/js/chunk-vendors.e7ac9ff2.js rel=preload as=script> <link href=/css/app.0b79487b.css rel=stylesheet></head><body><div id=app></div><script src=/js/chunk-vendors.e7ac9ff2.js></script><script src=/js/app.ba2d9b8a.js></script></body></html>1
2
3
4
5
// vue.config.js module.exports = { publicPath: '/',}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html><html lang=en><head> <title>test</title> <link href=/css/app.0b79487b.css rel=preload as=style> <link href=/js/app.ba2d9b8a.js rel=preload as=script> <link href=/js/chunk-vendors.e7ac9ff2.js rel=preload as=script> <link href=/css/app.0b79487b.css rel=stylesheet></head><body><div id=app></div><script src=/js/chunk-vendors.e7ac9ff2.js></script><script src=/js/app.ba2d9b8a.js></script></body></html>3、设置为./时,部署后请求路径:
1
2
3
4
5
// vue.config.js module.exports = { publicPath: './',}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html><html lang=en><head> <title>test</title> <link href=css/app.0b79487b.css rel=preload as=style> <link href=js/app.8569d42d.js rel=preload as=script> <link href=js/chunk-vendors.e7ac9ff2.js rel=preload as=script> <link href=css/app.0b79487b.css rel=stylesheet></head><body><div id=app></div><script src=js/chunk-vendors.e7ac9ff2.js></script><script src=js/app.8569d42d.js></script></body></html>4、设置为static时,部署后请求路径:
1
2
3
4
5
// vue.config.js module.exports = { publicPath: 'static',}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html><html lang=en><head> <title>test</title> <link href=static/css/app.0b79487b.css rel=preload as=style> <link href=static/js/app.d0717808.js rel=preload as=script> <link href=static/js/chunk-vendors.e7ac9ff2.js rel=preload as=script> <link href=static/css/app.0b79487b.css rel=stylesheet></head><body><div id=app></div><script src=static/js/chunk-vendors.e7ac9ff2.js></script><script src=static/js/app.d0717808.js></script></body></html>5、设置为./static时,部署后请求路径:
1
2
3
4
5
// vue.config.js module.exports = { publicPath: './static',}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html><html lang=en><head> <title>test</title> <link href=static/css/app.0b79487b.css rel=preload as=style> <link href=static/js/app.d0717808.js rel=preload as=script> <link href=static/js/chunk-vendors.e7ac9ff2.js rel=preload as=script> <link href=static/css/app.0b79487b.css rel=stylesheet></head><body><div id=app></div><script src=static/js/chunk-vendors.e7ac9ff2.js></script><script src=static/js/app.d0717808.js></script></body></html>6、设置为../static时,部署后请求路径:
1
2
3
4
5
// vue.config.js module.exports = { publicPath: '../static',}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html><html lang=en><head> <title>test</title> <link href=../static/css/app.0b79487b.css rel=preload as=style> <link href=../static/js/app.695b7ccc.js rel=preload as=script> <link href=../static/js/chunk-vendors.e7ac9ff2.js rel=preload as=script> <link href=../static/css/app.0b79487b.css rel=stylesheet></head><body><div id=app></div><script src=../static/js/chunk-vendors.e7ac9ff2.js></script><script src=../static/js/app.695b7ccc.js></script></body></html>
7、设置为../时,部署后请求路径:
1
2
3
4
5
// vue.config.js module.exports = { publicPath: '../',}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html><html lang=en><head> <title>test</title> <link href=../css/app.0b79487b.css rel=preload as=style> <link href=../js/app.67ace555.js rel=preload as=script> <link href=../js/chunk-vendors.e7ac9ff2.js rel=preload as=script> <link href=../css/app.0b79487b.css rel=stylesheet></head><body><div id=app></div><script src=../js/chunk-vendors.e7ac9ff2.js></script><script src=../js/app.67ace555.js></script></body></html>-
11款汉兰达油泵保险丝在哪里?
11款汉兰达油泵保险丝在发动机舱内保险盒内,油泵是一种既轻便又紧凑的泵,有直列式、分配式和单体式三大类。油泵要有动力源才能运转,其下部的凸轮轴是由发动机曲轴齿轮带动的。以汉兰达...
问答查看全文>> -
本田皓影和冠道有什么区别?
本田冠道和本田全新车型皓影两款车级别不同,价格水平相差很多,本田冠道定位为中型SUV,本田皓影定位为紧凑型SUV,将在广汽推出,和本田CRV是兄弟车型,竞争对手是全新的丰田RA...
问答查看全文>>
推荐
- 1方向盘有异响怎么回事,方向盘可以换吗403
- 2牛年春节祝福语怎么写120
- 3桑塔纳2019两厢价格多少?360
- 4一加BudsPro真无线耳机评测 一加BudsPro秘银配色怎么样317
- 5车内香水爆炸是真的吗?323
- 6单相稳压器哪个牌子好 单相稳压器十大品牌排行榜373
- 7磁性车贴能贴玻璃上吗?139
- 8小风扇哪个牌子好 小风扇十大品牌排行榜297