- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 6.3k
 
Open
Description
Version
3.8.4
Reproduction link
https://github.com/iUUCoder/issues-demo__vue-cli
Environment info
System:
    OS: macOS 10.14.5
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
  Binaries:
    Node: 8.16.0 - ~/git/nvm/versions/node/v8.16.0/bin/node
    Yarn: Not Found
    npm: 6.4.1 - ~/git/nvm/versions/node/v8.16.0/bin/npm
  Browsers:
    Chrome: 75.0.3770.142
    Firefox: Not Found
    Safari: 12.1.1
  npmGlobalPackages:
    @vue/cli: 3.8.4Steps to reproduce
执行命令,构建应用:
npm run buildWhat is expected?
构建时,对 CSS 中用到的 url 进行处理。
What is actually happening?
vue.config.js 中的配置:
module.exports = {
  pages: {
    "pages/home/index": {
      entry: "./src/pages/home/index.js",
      template: "src/pages/home/index.html"
    }
  }
};项目源码 src/pages/home/Index.vue 中,设置了样式:
.page {
    color: red;
    background-image: url("./res/image.png");
}构建输出结构:
dist
├── css
│   └── pages
│       └── home
│           └── index.0a0cd7d2.css
├── img
│   └── image.6704b667.png
├── js
│   ├── chunk-vendors.2ce01813.js
│   ├── chunk-vendors.2ce01813.js.map
│   └── pages
│       └── home
│           ├── index.cc5a5f68.js
│           └── index.cc5a5f68.js.map
└── pages
    └── home
        └── index.html构建后的 dist/css/pages/home/index.0a0cd7d2.css:
.page{color:red;background-image:url(../img/image.6704b667.png)}问题:
构建结果,对 CSS 中的相对路径处理不正确,没有考虑到配置了多级目录的情况。
Metadata
Metadata
Assignees
Labels
No labels