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

Alias in css don't work ? #650

Closed
stephanedemotte opened this issue Jul 30, 2020 · 5 comments
Closed

Alias in css don't work ? #650

stephanedemotte opened this issue Jul 30, 2020 · 5 comments

Comments

@stephanedemotte
Copy link

Describe the bug

I've use alias but it seem not work in style

Reproduction

in vite.config.js

export default {
  alias: { '/~/': require('path').resolve(__dirname, 'src') },
}

in App.vue alias work in script

<script>
import { test } from '/~/Settings.js'
<script>

But don't in style

<style>
@import '/~/css/Global.css'
</style>

System Info

  • required vite version: v1.0.0-rc.3
  • required Operating System: Linux
  • required Node version: v12.11.1
  • Optional:
    • npm/yarn version 1.12.3
    • Installed vue version (from yarn.lock or package-lock.json) 3.0.0-rc.4
    • Installed @vue/compiler-sfc version 3.0.0-rc.4
@yyx990803
Copy link
Member

We need to use postcss-import's resolve option to handle Vite's aliases.

underfin added a commit to rolldown/vite that referenced this issue Aug 8, 2020
@ghost
Copy link

ghost commented Sep 11, 2020

so the question was solved in which version?

@jkwill87
Copy link

@Ruthevil it doesn't look like @phanmn's changes have been merged into this repo yet

@oleksii-shaposhnikov
Copy link

@yyx990803 so how to import scss correctly like in the example in the description?

@Niputi
Copy link
Contributor

Niputi commented Apr 19, 2021

@oleksii-shaposhnikov you should ask questions in discord chat https://chat.vitejs.dev/ or at https://github.com/vitejs/vite/discussions instead of in old closed issues

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.

5 participants