Skip to content

Using SFC in markdown, styles in the <style> tag is not effect. #3216

@ghost

Description

Describe the bug

when I bump vitepress to 1.0.0-rc.26, I found the styles in <style> were not included in the packaged product.

The style here is normal in the development environment, but it doesn't work after packing.

<template>
  <div class="box">Preview after packing, The text color is expected to be red</div>
</template>

<style>
.box {
  color: red;
}
</style>

I try downgraded to 1.0.0-rc.25, it was normal.

Reproduction

reproduction link:
https://stackblitz.com/edit/vite-xmetfv?file=docs%2FDemo.vue

Expected behavior

Packaged for preview and styles can also take effect

related documents:
https://vitepress.dev/guide/using-vue#script-and-style

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
    CPU: (16) x64 AMD Ryzen 7 4800H with Radeon Graphics
    Memory: 6.16 GB / 7.44 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 18.18.2 - ~/.nvm/versions/node/v18.18.2/bin/node
    Yarn: 1.22.19 - /mnt/c/Program Files/nodejs/yarn
    npm: 9.8.1 - ~/.nvm/versions/node/v18.18.2/bin/npm
    pnpm: 8.10.5 - ~/.nvm/versions/node/v18.18.2/bin/pnpm
    bun: 1.0.12 - ~/.nvm/versions/node/v18.18.2/bin/bun
  npmPackages:
    vitepress: 1.0.0-rc.26 => 1.0.0-rc.26

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildRelated to the build system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions