Skip to content

[Bug Report] postcss-csso breaks vue v-bind styles in build mode #9

@meteorlxy

Description

@meteorlxy

Describe the bug

Step to Reproduce:

  • npm run dev: Things work well in dev mode, the text is getting bigger.
  • npm run build && npm run preview: Breaks, the text size is static.

Explanation:

  • vite:css plugin will transform style code via postcss (postcss-csso), then the v-bind(font + 'px') will be transformed to v-bind(font + "px") (single quote to double quote)
  • @vue/compiler-sfc will use different keys to generate css-var name:
    • use hash(id + `font + 'px'`) -> 6507bc59 in script block
    • use hash(id + `font + "px"`) -> 65057679 in style block

Reproduction

https://stackblitz.com/edit/vitejs-vite-ovp8hf?file=vite.config.ts

System Info

Not Related

Used Package Manager

pnpm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions