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 use @import url() When this style file also imported by other files, an error will be reported #13143

Closed
2 of 7 tasks
clt111 opened this issue May 10, 2023 · 2 comments · Fixed by #17857
Closed
2 of 7 tasks
Labels
feat: css p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@clt111
Copy link

clt111 commented May 10, 2023

Describe the bug

// index.tsx
import './index.less' export const Test = () => { const text = '测试测试' return ( <> <div className="content">{text}</div> <div className="abc">{text}</div> </> ) }

// index.less
@import '../../../first/index.less'; .content { width: 100px; height: 100px; background-color: yellow; }

// first/index.less
@import './test.less'; // when i use this, it will be OK
@import url('./test.less'); // when i use @import url() , it will report error

error message like this:
[plugin:vite:css] [less] '../../../first/test.less' wasn't found. Tried - /home/projects/first/test.less,../../first/test.less,../../../first/test.less

Reproduction

https://stackblitz.com/edit/vitejs-vite-sawjss?file=src/second/many/other/index.less

Steps to reproduce

No response

System Info

"vite": "^4.3.2"

Used Package Manager

npm

Logs

No response

Validations

@stackblitz
Copy link

stackblitz bot commented May 10, 2023

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@sapphi-red sapphi-red added feat: css p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels May 10, 2023
@clt111 clt111 changed the title less use @import url() When this style file also has a relative path url imported, an error will be reported less use @import url() When this style file also imported by other files, an error will be reported May 10, 2023
@bluwy
Copy link
Member

bluwy commented May 14, 2023

Maybe related #8400

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: css p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants