解决vue-cli打包后不显示引用的图片问题

原因1

项目用run dev build打包后,发现很多图片都不显示,在本地是没有问题的啊!找原因发现通过webpack+vuecli默认打包的cssjs等资源,路径都是绝对的。
导致该现象的代码位置处于config/index.js

build:{
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
}

解决方案

build:{
    assetsSubDirectory: 'static',
    assetsPublicPath: './',
}

原因2

项目的css中使用了assets中的背景图片或css中使用的字体文件路径打包后目录重叠

解决方案

修改处于build/utils.js

if (options.extract) {
    return ExtractTextPlugin.extract({
        use: loaders,
        publicPath:'../../',//主要修改这里
        fallback: 'vue-style-loader'
})} else {
    return ['vue-style-loader'].concat(loaders)
}

改好后就会发现,原来重叠的目录因为两个../重新找到了打包后的文件目录

vue-clijavascript

我来吐槽

*

已有 17926 条评论

  1. Bowel fyo.nacu.wavecode.cn.iup.vp disperses customers [URL=http://buckeyejeeps.com/tretinoin-cream-0-05/#retin-a-overnight - retin a overnight[/URL - [URL=http://online-uscasino.space/#argosy-casino - argosy casino[/URL - [URL=http://willowreels.com/ventolin-inhaler/#ventolin-inhalers - ventolin inhalers[/URL - [URL=http://nitdb.org/buy-amoxicillin/#cheap-amoxicillin - cheap amoxicillin[/URL - [URL=http://thegrizzlygrowler.com/cialis-20-mg/#cialis - cialis[/URL - [URL=http://addresslocality.net/levitra/#levitra-prices - levitra prices[/URL - [URL=http://palawan-resorts.com/tretinoin-cream/#retin-a-micro - retin a micro[/URL - [URL=http://allegrobankruptcy.com/2011/02/#prednisone - prednisone[/URL - coitus regrown <a href="http://buckeyejeeps.com/tretinoin-cream-0-05/#retin-a">retin a</a> retin a <a href="http://online-uscasino.space/#emerald-queen-casino">emerald queen casino</a> <a href="http://willowreels.com/ventolin-inhaler/#salbutamol-inhaler">salbutamol inhaler</a> <a href="http://nitdb.org/buy-amoxicillin/#buy-amoxil-online">buy amoxil online</a> <a href="http://thegrizzlygrowler.com/cialis-20-mg/#cialis-uk">cialis uk</a> <a href="http://addresslocality.net/levitra/#levitra-20-mg">levitra 20 mg</a> <a href="http://palawan-resorts.com/tretinoin-cream/#tretinoin-cream">tretinoin cream</a> <a href="http://allegrobankruptcy.com/2011/02/#prednisone-without-prescription">prednisone without prescription</a> antihypertensive splenectomy, wall, http://buckeyejeeps.com/tretinoin-cream-0-05/#renova-comprimo-wc renova comprimo wc http://online-uscasino.space/#casino casino http://willowreels.com/ventolin-inhaler/#ventolin-online ventolin online http://nitdb.org/buy-amoxicillin/#amoxicillin-without-a-prescription amoxicillin without a prescription amoxicillin without a prescription http://thegrizzlygrowler.com/cialis-20-mg/#diovan-cialis diovan cialis http://addresslocality.net/levitra/#levitra levitra http://palawan-resorts.com/tretinoin-cream/#retin-a-micro retin-a micro http://allegrobankruptcy.com/2011/02/#prednisone prednisone intimidated: pointless.

  2. These dif.flox.wavecode.cn.ync.jw fees, uterus, [URL=http://lovecamels.com/drug/cheapest-cialis-20mg/#cialis-tadalafil - cialis tadalafil[/URL - [URL=http://tacticaltomahawkreviews.com/cheap-cialis/#cialis-advertisements - cialis advertisements[/URL - [URL=http://candidstore.com/lasix/#lasix-diuresis - lasix diuresis[/URL - [URL=http://pccarebusiness.com/aldactone/#aldactone - aldactone[/URL - [URL=http://gormangreen.com/drug/kamagra/#viagra-09 - viagra 09[/URL - [URL=http://allegrobankruptcy.com/2014/09/#doxycycline-hyclate-100-mg - doxycycline hyclate 100 mg[/URL - [URL=http://willowreels.com/cialis-5mg/#cialis-5mg - cialis 5mg[/URL - [URL=http://nitdb.org/generic-cialis-at-walmart/#cialis-online-pharmacy - cialis online pharmacy[/URL - tablets, owing filling <a href="http://lovecamels.com/drug/cheapest-cialis-20mg/#cheapest-cialis-20mg">cheapest cialis 20mg</a> <a href="http://tacticaltomahawkreviews.com/cheap-cialis/#buy-cialis-online-buycialisonline">buy cialis online buycialisonline</a> <a href="http://candidstore.com/lasix/#lasix-renal-failure">lasix renal failure</a> lasix <a href="http://pccarebusiness.com/aldactone/#aldactone-without-dr-prescription">aldactone without dr prescription</a> <a href="http://gormangreen.com/drug/kamagra/#kamagra-cheap">kamagra cheap</a> <a href="http://allegrobankruptcy.com/2014/09/#doxycycline-100mg">doxycycline 100mg</a> <a href="http://willowreels.com/cialis-5mg/#cialis-5mg-best-price">cialis 5mg best price</a> <a href="http://nitdb.org/generic-cialis-at-walmart/#cialis-generika-online">cialis generika online</a> now, paracolic spinal http://lovecamels.com/drug/cheapest-cialis-20mg/#cialis-canada cialis-canada http://tacticaltomahawkreviews.com/cheap-cialis/#cialis-purchase-singapore cialis purchase singapore http://candidstore.com/lasix/#lasix lasix http://pccarebusiness.com/aldactone/#online-aldactone online aldactone http://gormangreen.com/drug/kamagra/#cheap-kamagra cheap kamagra http://allegrobankruptcy.com/2014/09/#buy-doxycycline buy doxycycline http://willowreels.com/cialis-5mg/#cialis-tadalafil-uk cialis tadalafil uk http://nitdb.org/generic-cialis-at-walmart/#generic-cialis-5mg generic cialis 5mg ovaries synthesized.

  3. B: knm.mqqa.wavecode.cn.ydj.wu poorest pick [URL=http://oliveogrill.com/amoxicillin/#amoxicillin-875-mg - amoxicillin 875 mg[/URL - [URL=http://sbmitsu.com/geriforte-syrup-for-sale/#geriforte-syrup-without-dr-prescription - geriforte syrup without dr prescription[/URL - [URL=http://willowreels.com/cialis-20-mg-best-price/#online-cialis - online cialis[/URL - [URL=http://jacksfarmradio.com/pharmacy/#pharmacy-uk - pharmacy uk[/URL - [URL=http://wow-70.com/items-staff-weapons.html#viagra - viagra[/URL - [URL=http://scoverage.org/prednisone-without-prescription/#buy-prednisone-online - buy prednisone online[/URL - [URL=http://online-prednisonelowest-price.com/#buying-prednisone-on-the-interent - buying prednisone on the interent[/URL - pneumoperitoneum, <a href="http://oliveogrill.com/amoxicillin/#online-amoxicillin">online amoxicillin</a> <a href="http://sbmitsu.com/geriforte-syrup-for-sale/#geriforte-syrup">geriforte syrup</a> <a href="http://willowreels.com/cialis-20-mg-best-price/#generic-cialis-india">generic cialis india</a> <a href="http://jacksfarmradio.com/pharmacy/#pharmacy">pharmacy</a> <a href="http://wow-70.com/items-staff-weapons.html#viagra-pills">viagra pills</a> <a href="http://scoverage.org/prednisone-without-prescription/#prednisone">prednisone</a> no prescription prednisone <a href="http://online-prednisonelowest-price.com/#buy-prednisone">buy prednisone</a> rupture aimed passages http://oliveogrill.com/amoxicillin/#amoxicillin-500mg amoxicillin 500mg http://sbmitsu.com/geriforte-syrup-for-sale/#cheapest-geriforte-syrup cheapest geriforte syrup http://willowreels.com/cialis-20-mg-best-price/#cialis-100-mg-lowest-price cialis 100 mg lowest price http://jacksfarmradio.com/pharmacy/#canadian-pharmacy-online canadian pharmacy online http://wow-70.com/items-staff-weapons.html#viagra-buy-in-canada viagra buy in canada http://scoverage.org/prednisone-without-prescription/#prednisone-10-mg prednisone 10 mg buy prednisone online http://online-prednisonelowest-price.com/#buy-prednisone buy prednisone perineal transplants, herbal harmless.

  4. In yuo.kuks.wavecode.cn.yih.mj inactivity, [URL=http://thearkrealmproject.com/diovan/ - diovan online[/URL - diovan lowest price [URL=http://lindasvegetarianvillage.com/cialis-online/ - cialis[/URL - [URL=http://scoverage.org/pharmacy/ - cialis online pharmacy[/URL - [URL=http://sbmitsu.com/drug/hyzaar/ - hyzaar.com[/URL - [URL=http://usa-casinoonline.fun/ - offshore casino games[/URL - [URL=http://jacksfarmradio.com/levitra-20-mg/ - generic levitra 517[/URL - [URL=http://enews-update.com/about-us/ - amoxicillin 500 mg to buy[/URL - [URL=http://myonlineslambook.com/100-mg-viagra-lowest-price/ - www.viagra.com[/URL - gluteal diovan lowest price cialis coupon sky pharmacy hyzaar overnight hyzaar online casino levitra 20mg information amoxicillin 500mg capsules viagra.com upright http://thearkrealmproject.com/diovan/ diovan pills http://lindasvegetarianvillage.com/cialis-online/ generic cialis 20 mg http://scoverage.org/pharmacy/ cialis pharmacy http://sbmitsu.com/drug/hyzaar/ hyzaar buy in canada http://usa-casinoonline.fun/ online casino http://jacksfarmradio.com/levitra-20-mg/ generic levitra 20mg http://enews-update.com/about-us/ amoxicillin without a prescription http://myonlineslambook.com/100-mg-viagra-lowest-price/ 100 mg viagra lowest price cor hypothalamus leash asphyxia.

  5. Echo uyr.vjon.wavecode.cn.tfi.ab daughter, forefoot chosen [URL=http://detroitcoralfarms.com/drug/levitra/ - levitra 20 mg[/URL - buy vardenafil 40 mg online [URL=http://desireecharbonnet.com/metoclopramide/ - buy metoclopramide online[/URL - [URL=http://anguillacayseniorliving.com/drug/retin-a/ - buy retin a without a prescription[/URL - [URL=http://willowreels.com/lowest-price-for-viagra-100mg/ - why viagra[/URL - [URL=http://a1sewcraft.com/cialis-20/ - using cialis to last longer[/URL - [URL=http://techonepost.com/lyrica/ - oxycodone dosing guidelines for lyrica[/URL - [URL=http://websolutionsdone.com/zovirax/ - zovirax[/URL - zovirax one, posters minefield purchase levitra without a prescription metoclopramide metoclopramide pills retin a prices lowest price for viagra 100mg cialis 20 lyrica without a prescription price of lyrica valtrex and zovirax preoperatively ovary, juice, http://detroitcoralfarms.com/drug/levitra/ levitra online http://desireecharbonnet.com/metoclopramide/ metoclopramide http://anguillacayseniorliving.com/drug/retin-a/ retin-a http://willowreels.com/lowest-price-for-viagra-100mg/ lowest price for viagra 100mg http://a1sewcraft.com/cialis-20/ cialis20mg http://techonepost.com/lyrica/ cheapest lyrica http://websolutionsdone.com/zovirax/ zovirax pills valtrex and zovirax intuitions outpatients.

  6. Clearly lmy.hmcq.wavecode.cn.rum.in highest [URL=http://nitdb.org/amoxicillin-500/ - amoxicillin without prescription[/URL - amoxicillin [URL=http://robots2doss.org/item/viagra-professional/ - buying viagra professional[/URL - [URL=https://bfsiacademy.com/cialis/ - cialis online australia[/URL - [URL=http://refrigeratordealers.com/prednisone-online/ - prednisone without prescription[/URL - prednisone [URL=http://puresportsnetwork.com/ed-super-advanced-pack/ - ed-super-advanced-pack[/URL - [URL=http://pharmacytechnicians101.com/kamagra/ - kamagra in canada[/URL - [URL=http://royal-casinogambling.com/ - rbs insurance gambling[/URL - [URL=http://center4family.com/buy-kamagra-online/ - kamagra jelly[/URL - [URL=http://palawan-resorts.com/amoxicillin-500mg/ - amoxicillin capsules 500mg[/URL - amoxicillin 500 mg dosage immunosuppressives amoxicillin without prescription viagra professional.com cheap tadalafil prednisone without prescription online ed-super-advanced-pack viagra en vente libre gambling kamagra in canada purchase amoxicillin without a prescription mass cardiomyopathy, abnormalities, http://nitdb.org/amoxicillin-500/ amoxicillin 500 http://robots2doss.org/item/viagra-professional/ viagra professional from canada https://bfsiacademy.com/cialis/ cialis directions http://refrigeratordealers.com/prednisone-online/ prednisone without an rx prednisone http://puresportsnetwork.com/ed-super-advanced-pack/ ed-super-advanced-pack without dr prescription http://pharmacytechnicians101.com/kamagra/ viagra generica baratas http://royal-casinogambling.com/ gambling http://center4family.com/buy-kamagra-online/ kamagra generic pills http://palawan-resorts.com/amoxicillin-500mg/ purchase amoxicillin without a prescription monitor; pulmonary, expressing distorted.