Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Less 中使用 http的资源地址,路径会解析错误 #3644

Closed
6 tasks done
minjs1cn opened this issue Jun 2, 2021 · 1 comment · Fixed by #10741
Closed
6 tasks done

Less 中使用 http的资源地址,路径会解析错误 #3644

minjs1cn opened this issue Jun 2, 2021 · 1 comment · Fixed by #10741

Comments

@minjs1cn
Copy link

minjs1cn commented Jun 2, 2021

Describe the bug

the url in less, may be resolve error.

Reproduction

Example

System Info

Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:

  System:
    OS: macOS Mojave 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
    Memory: 986.89 MB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 14.16.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.11 - /usr/local/bin/npm
  Browsers:
    Chrome: 91.0.4472.77
    Safari: 14.1
  npmPackages:
    vite: ^2.3.5 => 2.3.5 

Used package manager:

Logs

GET http://localhost:3001/minixs/https://a.com/test.png 404 (Not Found)

Before submitting the issue, please make sure you do the following

@bluwy
Copy link
Member

bluwy commented Mar 11, 2022

Still reproducible in Vite 2.9.0-beta.0. Note the issue is in src/style/index.less where the Less file is transform into

const __vite__css = "body {\n  background-image: url('../minixs/https://a.com/test.png');\n}\n"

in dev mode. Notice that the url should not have a prefix of ../minixs/.

@bluwy bluwy added the bug label Mar 11, 2022
patak-dev pushed a commit that referenced this issue Nov 1, 2022
Co-authored-by: frank <frank@hebingjundeMacBook-Pro.local>
@github-actions github-actions bot locked and limited conversation to collaborators Nov 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants