Skip to content

Setting style.scoped to true / false in Vue options has no effect #7832

@pmk1c

Description

@pmk1c

Describe the bug

When I set style.scoped: true in Vue plugin options, I would have expected, that all SFCs would now use scoped styles. But it does not seem to have any effect.

The same goes for setting style.scoped: false. I would have expected, it overrides SFCs, that explicitly set style scoped, not to use scoped styles.

I think the bug (if it is one and not intended) is, that block.scoped always overrides style.scoped here: https://github.com/vitejs/vite/blob/main/packages/plugin-vue/src/style.ts#L25

Reproduction

https://stackblitz.com/edit/vitejs-vite-oiw3bg?file=vite.config.js

System Info

System:
    OS: macOS 12.2.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 33.63 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.14.2 - ~/.asdf/installs/nodejs/16.14.2/bin/node
    npm: 8.5.0 - ~/.asdf/plugins/nodejs/shims/npm
  Browsers:
    Chrome: 100.0.4896.127
    Firefox: 98.0.2
    Safari: 15.3
  npmPackages:
    @vitejs/plugin-vue: * => 2.3.1 
    vite: * => 2.9.1

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions