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

?url import is not working as expected with css files #7102

Closed
7 tasks done
saurabhdaware opened this issue Feb 26, 2022 · 2 comments
Closed
7 tasks done

?url import is not working as expected with css files #7102

saurabhdaware opened this issue Feb 26, 2022 · 2 comments

Comments

@saurabhdaware
Copy link
Contributor

saurabhdaware commented Feb 26, 2022

Describe the bug

Heya!! so if I import .css files with ?url, I get export default text in the string. This does not happen when I import any other asset with ?url flag.

import styleUrl from './xyz.css?url'; // importing css file as URL
import jsUrl from './xyz.js?url';  // importing js file as URL

console.log(styleUrl); // this outputs text like, " export default './client/xyz.css' "
console.log(jsUrl); // this outputs text like " './client/xyz.js' "

I have added a reproduction link that shows the issue.

Reproduction

https://stackblitz.com/edit/vitejs-vite-ybvvxo?file=main.js&terminal=dev

System Info

System:
    OS: macOS 11.4
    CPU: (8) x64 Apple M1
    Memory: 24.57 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.5.0 - ~/.nvm/versions/node/v16.5.0/bin/node
    Yarn: 1.22.15 - ~/.yarn/bin/yarn
    npm: 7.19.1 - ~/.nvm/versions/node/v16.5.0/bin/npm
  Browsers:
    Brave Browser: 97.1.34.80
    Chrome: 98.0.4758.109
    Safari: 14.1.1

Used Package Manager

npm

Logs

No response

Validations

@sapphi-red
Copy link
Member

It seems like this is a duplicate of #3833.

@saurabhdaware
Copy link
Contributor Author

Oh my bad. Yes it is. I think the discussion is happening here #2522 (comment).

Closing this issue then.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants