CARVIEW |
Select Language
HTTP/2 200
date: Sun, 20 Jul 2025 05:03:13 GMT
content-type: text/html; charset=utf-8
cache-control: max-age=0, private, must-revalidate
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
link: ; rel=preload; as=fetch; crossorigin=use-credentials
referrer-policy: no-referrer-when-downgrade
server-timing: issue_layout-fragment;desc="issue_layout fragment";dur=500.325646,issue_conversation_content-fragment;desc="issue_conversation_content fragment";dur=554.609965,issue_conversation_sidebar-fragment;desc="issue_conversation_sidebar fragment";dur=53.290591,nginx;desc="NGINX";dur=1.437297,glb;desc="GLB";dur=95.471199
strict-transport-security: max-age=31536000; includeSubdomains; preload
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With, Accept,Accept-Encoding, Accept, X-Requested-With
x-content-type-options: nosniff
x-frame-options: deny
x-voltron-version: fd8fbbc
x-xss-protection: 0
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=c0ox967lzm1PoLrwl7xGSoh7F1q7DMH32JeoSkxcKV0LG%2FOtjgGjcZ6dzznW6wjRjxzsoPaaVqzchElnSK9G7Stv41VzewbLLIkF0O%2Bbele46K1n%2FL7oT0lEznZ2mnDjXN%2FWlUHq0EfmnBxwGxvdMjlJZuEnldZJYmNOizmg86WUFLO3qtYuitjOp%2FDfX0iCrlnr2NbUjQpkK8TSQGWGGUn8bhGOqh7jaIk%2FnpVBd5CsQA%2B62VdBI3THE9T4ZhG1eQlSTo9R%2BcyWhjvLu1LFwg%3D%3D--rnWuEdB32MEiQPeC--2nsAdCtm%2FYrat3dbvG4jyQ%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.1619707243.1752987792; Path=/; Domain=github.com; Expires=Mon, 20 Jul 2026 05:03:12 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Mon, 20 Jul 2026 05:03:12 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: 8A56:2E5CB6:16F4DD:20112A:687C7890
生成的css文件中background url()图片路径问题 · Issue #481 · vuejs/vue-loader · GitHub

No one assignedNo typeNo projectsNo milestoneNone yetNo branches or pull requests
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 919
Closed
Labels
Description
重现项目在这
使用vue init webpack创建的项目,改了三个地方
- webpack.base.conf.js配置文件output的publicPath注释起来
- App.vue中给body加了background样式
- 把url-loader的limit改成了6000,避免base64转换而不使用file-loader
现象:
npm run dev没问题 因为跟build的目录不同
当npm run build后
提取出来的css文件中url()中图片的路径是static/img/logo.82b9c7a.png这样的,应该是根据url-loader来的,但这个路径是相对于css文件的,所以造成找不到这张图片
个人几个解决方案:
- 把webpack配置文件的output的publicPath设置成’/‘(初始化的项目默认是这样的),这样所有引用文件都会从’/‘开始,不会出现找不到文件的情况。但我是在一个域名下有多个项目的,不一定会把这个项目放到根目录。如:a.com/test1/index.html 会放到test1目录下,如果设置成’/‘就会直接到a.com/下找,还是会找不到,如果修改成/test1 因为这个目录非常多,更新特别频繁,如果每一个都需要修改也挺麻烦,上边的修改把output的publicPath注释起来也是因为这个
- webpack.prod.conf.js中ExtractTextPlugin插件目录中的css文件夹搞成上级目录“..”,这样css文件就会跟index.html在相同目录,其中的url目录就会正确了,但感觉破坏了目录结构,不知道好不好~(现在用的这种解决方案,因为多个项目可以使用相同的配置)
- 手动改~因为这几次样式里边url()用的还比较少,多了就不靠谱了
这个问题纠结了很久 看了css-loader file-loader文档,看了很多以前的issue,网上查了很久,都没有找到相应的解决方法,因为实在找不到应该修改哪一部分。上边说的几个解决方法,总感觉不靠谱~
忍不了了所以来提个issue 望大牛们指点迷津
chensisihai, chenam, liuxingyun2010, Krispomoho, jerryachel and 21 more
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Issue actions
You can’t perform that action at this time.