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

Vite error with inlineImports: false #3609

Closed
erkage opened this issue Mar 10, 2024 · 0 comments · Fixed by #3743
Closed

Vite error with inlineImports: false #3609

erkage opened this issue Mar 10, 2024 · 0 comments · Fixed by #3743

Comments

@erkage
Copy link

erkage commented Mar 10, 2024

UnoCSS version

0.58.5

Describe the bug

If I add inlineImports: false to the presetWebFonts config I'm getting the following error/warn msg in Vite console:

[vite:css] @import must precede all other statements (besides @charset or empty @layer)
1  |  __uno_hash_5892cf{--:'';}/* layer: imports */
2  |  @import url('https://fonts.googleapis.com/css2?family=Hanken+Grotesk:wght@300;400;700&family=Chivo&family=Trirong&display=swap');
   |  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (x6)

here is my unocss config:

import {
  defineConfig,
  presetWebFonts,
} from 'unocss'

export default defineConfig({
   presets: [
      presetWebFonts({
         provider: 'google',
         inlineImports: false,
         fonts: {
            hankengrotesk: 'Hanken Grotesk:300,400,700',
            chivo: 'Chivo',
            trirong: 'Trirong',
         },
      }),
   ],
})

Reproduction

  1. If vite runs stop it
  2. add inlineImports: false to your presetWebFonts config.
  3. start vite

https://stackblitz.com/edit/unocss-unocss-wo5zvl?file=src%2FApp.vue

Other info

With latest "vite": "^5.1.5" version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants